JSP whitespace

Hello,
Would anyone happen to know of a clean way to disable whitespace output in JSP tags? The problem I am facing is that if I indent my JSPs properly, they will output an unacceptable amount of whitespace. I can split my tags on several lines:
<c:out value="${SomeBean.someNestedBean.reallyDeepNestedBean.funkyIndexedProperty[indexCalculatedWithComplexELExpression].label}"/>
but this will make the JSP hard to read. I could put line breaks inside JSP comments like this:
<c:forEach items="${stuff}" var="stuffItem"><%--
--%><c:choose><%--
--%> <c:when test="${someCondition}"><%--
--%> <c:out value="${stuffItem.this}"/><%--
--%> </c:when><%--
--%> <c:otherwise><%--
--%> <c:out value="${stuffItem.that}"/><%--
--%> </c:otherwise><%--
--%></c:choose><%--
--%>
</c:forEach>
But this seems like a kludgy solution. Would migrating to XML syntax help?

No, using XML won't help. There's no real way to
clean it up, however, if you are using HTML, and not
using PRE tags, then I'm not sure why there's a
problem. It shouldn't matter what the source is, the
HTML page will still display properly.It is a problem when the document contains more whitespace than actual characters. It is also a problem when I want my JSPs to output valid XHTML (or other XML) documents and the taglib declarations and other directives are at the beginning of the file.

Similar Messages

  • Whitespace in XML-Style JSP

    Hi,
    I am having a slight issue with the XHTML content generated by a JSP. The output is stripped entirely of all whitespace, such that the content is all on one line. I have a request from one of our content writers to view the source "nicely". Oddly, in all of my searches for this problem, I have found people experiencing the opposite problem.
    Suppose I have a JSP like so:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
    <jsp:directive.page language="java" contentType="text/html;charset=ISO-8859-1"/>
    <html>
    <head>
         <title>A JSP Page</title>
    </head>
    <body>
         <table>
              <tr>
                   <td>Table Cell</td>
              </tr>
         </table>
    </body>
    </html>
    </jsp:root>The resulting output is:
    <html><head><title>A JSP Page</title></head><body><table><tr><td>Table Cell</td></tr></table></body></html>How can I get the output to have the same indentation as the source?
    I am using Tomcat 4.1.29.
    Thanks!

    Hi Syed,
    Try these links:
    <a href="http://www.javaranch.com/newsletter/Feb2002/xmljsp.html">Exploring JSP Documents (XML Style JSP Pages)</a> --> an excellent overview of the benefits of JSP Documents (XML Style JSPs) over standard JSP Pages.
    <a href="http://www.webmonkey.com/webmonkey/01/22/index3a.html?tw=programming">Intro to JSP</a>
    You can also try googling for "XML Style JSP"...
    Regarding books on JSP 2.1 and Servlet 2.5 -- I really can't believe that there are none available! Have you tried searching on amazon?
    HTH!
    -Vladimir

  • How to removing whitespace in jsp

    hi,
    i am loading a jsp file, which had some space at the beginning. i want remove the space, then i need ot parse the data, just like ignoreWhiteSpace in xml. can anybody help on this.
    thanks
    ayathas

    Actually straight replacement will not work because it converts data to string because variables are expected.
    So there are at least two ways to deal with it:
    1. You can create a fake (unused) variable in JSP that prepends URL query - this way all the chars before will not interfere with reading variable:
      fake=fake&username=test&password=xxxxxxxx&result=true"
    2. In your complete handler you can read variables in a loop and hold them in a separate object:
    function completeHandler(e:Event):void
         var varObject:Object = {};
         for (var prop:String in e.target.data)
              trace(prop.replace(/^\W+/, ""), e.target.data[prop]);
              varObject[prop.replace(/^\W+/, "")] = e.target.data[prop];
         trace(varObject.password);

  • Validation of whitespace on textboxs in jsp

    hi the following code help mi to validate if all my textboxes is blank anot but it doesnt help mi validate theres any white space or if the person just enter a space in the box
    my form look smtg like this
    <input type=textbox name="choice<%=i%>
    so if i is =1 then it will look like the following
    <input type=textbox name="choice1>
    <input type=textbox name="choice1>
    <input type=textbox name="choice1>
    <input type=textbox name="choice1>
    i will increase according and it varies and the number of textbok with the same name also varies.
    The validation code to find blank textbos is written below but does any1 noe how to validate space?
    can any1 help me add in the code as an example
    var d=0;
    for(var d=0;d< <%=i-1%>; d++){
    var txtArray = eval("document.example.choices" + (d+1));
    for (var h= 0; h < txtArray.length; h++) {
    var val2 = txtArray[h].value;
    if (val2 == ""){
    alert("The choices"+" "+(h+1)+" "+"in question" +" "+(d+1)+" is not fill in."+" "+"Please fill in all the choices textboxes before submitting");
    txtArray[h].focus();
    return false; }
    }

    Hi i need help in this... its urgent
    currently i just subscribe to a web hosting site and i need to start the private tomcat in the web server..
    The followings are the instructions and i have follow them but i do not know how to create a web.xml file to store in the folder indicated for example a HelloServlet that im testing :
    To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in /var/www/html/WEB-INF directory.
    www root directory or webapps:/var/www/htm
    Classes directory located in: /var/www/html/WEB-INF/Classes/
    There you will need to upload your Java class file.
    Our default url-mapping for servlet is: /servlet/*
    To check servlet in your browser: www.mydomain.net/servlet/HelloWorld
    Jsp Files - Upload anywhere in /var/www/html
    all the above steps are follow except the web.xml file which i suppose to write and store in the folder... but i actually try to write one but i still cannot load my servlet on the webpage... test on standalone tomcat works.
    pls help its urgent!!!

  • If statement is not validating properly in JSP

    Actually i'm new to Java..
    The problem is when i take the parameter from another file which is an empty text box and i submit that. In the next jsp file i'am taking this value using getParameter("xxxx").
    if i send the empty or some value to this parameter, the if statement is not validating properly.
    here is my code in jsp....
    <%
    String bgcolor = request.getParameter("bgColor");
    out.println("Background Color = " + bgcolor);
    if (bgcolor == null)
    out.println("Hello Null");
    else
    out.println("Hello Not Null");
    %>
    Thanks in advance
    Kumar

    Hey there, you should know that Strings in Java are
    different from other types like int and double for
    example. Strings are objects so you cant check em
    with == but with the standard method .equals This is true but is not the problem here.
    @OP null and an empty length string are NOT the same thing. You probably want a check like
    if(bgColor.length()<1)And you might want to trim the String first to get rid of whitespace.

  • JSP request.getParameter bug

    i try the following code for receive Parameters from jsp.
    <% String name=request.getParameter("Name"); %>
    but when Name TextField(in HTML) is empty and i want to check
    for none empty field with (if) instruction with following code..
    if(name ==null ) //somecodes..
    this instruction not run and programs continue .

    It's not a bug.
    <%
    String name=request.getParameter("Name");
    if (name == null) {
      //what to do if parameter does not exist
      //e.g.: a checkbox not checked
    } else if (name.trim().equals("")) {
      //what to do if parameter exists but is 'empty'
      //e.g.: an text input field with no non-whitespace characters
      //NOTE: if you want leading and trailing spaces to be
      //      considered values, remove the .trim() from the condition
    } else {
      //there is a value.. do with it as you will
    %>

  • Urgent: SAX parser bean is not working in JSP page

    Hi All,
    I have created a bean "ReadAtts" and included into a jsp file using
    "useBean", It is not working. I tried all possibilities. But Failed Plz Help me.
    Below are the details:
    Java Bean: ReadAtts.java
    package sax;
    import java.io.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import java.util.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.ParserConfigurationException;
    public class ReadAtts extends DefaultHandler implements java.io.Serializable
         private Vector attNames = new Vector(); //Stores all the att names from the XML
         private Vector attValues = new Vector();
         private Vector att = new Vector();
         private Locator locator;
         private static String start="",end="",QueryString="",QString1="",QString2="";
    private static boolean start_collecting=false;
         public ReadAtts()
         public Vector parse(String filename,String xpath) throws Exception
    QueryString=xpath;
         StringTokenizer QueryString_ST = new StringTokenizer(QueryString,"/");
         int stLen = QueryString_ST.countTokens();
         while(QueryString_ST.hasMoreTokens())
              if((QueryString_ST.countTokens())>1)
              QString1 = QueryString_ST.nextToken();
    else if((QueryString_ST.countTokens())>0)
                   QString2 = QueryString_ST.nextToken();
         SAXParserFactory spf =
    SAXParserFactory.newInstance();
    spf.setValidating(false);
    SAXParser saxParser = spf.newSAXParser();
    // create an XML reader
    XMLReader reader = saxParser.getXMLReader();
    FileReader file = new FileReader(filename);
    // set handler
    reader.setContentHandler(this);
    // call parse on an input source
    reader.parse(new InputSource(file));
         att.add("This is now added");
         //return attNames;
    return att;
    public void setDocumentLocator(Locator locator)
    this.locator = locator;
    public void startDocument() {   }
    public void endDocument() {  }
    public void startPrefixMapping(String prefix, String uri) { }
    public void endPrefixMapping(String prefix) {  }
    /** The opening tag of an element. */
    public void startElement(String namespaceURI, String localName,String qName, Attributes atts)
    start=localName;
    if(start.equals(QString2))
    start_collecting=true; //start collecting nodes
    if(start_collecting)
    if((atts.getLength())>0)
    for(int i=0;i<=(atts.getLength()-1);i++)
    attNames.add((String)atts.getLocalName(i));
    attValues.add((String)atts.getValue(i));
    /** The closing tag of an element. */
    public void endElement(String namespaceURI, String localName, String qName)
    end = localName;
    if(end.equals(QString2))
         start_collecting=false; //stop colelcting nodes
    /** Character data. */
    public void characters(char[] ch, int start, int length) { }
    /** Ignorable whitespace character data. */
    public void ignorableWhitespace(char[] ch, int start, int length){ }
    /** Processing Instruction */
    public void processingInstruction(String target, String data) { }
    /** A skipped entity. */
    public void skippedEntity(String name) { }
    public static void main(String[] args)
    String fname=args[0];
    String Xpath=args[1];
    System.out.println("\n from main() "+(new ReadAtts().parse(fname,Xpath)));
    //System.out.println("\n from main() "+new ReadAtts().attNames());
    //System.out.println("\n from main() "+new ReadAtts().attValues());
    JSP File:
    <%@ page import="sax.*,java.io.*,java.util.*,java.lang.*,java.text.*;" %>
    <jsp:useBean id="p" class="sax.ReadAtts"/>
    Data after Parsing is.....
    <%=p.parse"E:/Log.xml","/acq/service/metrics/system/stackUsage")%>
    Expected Output:
    The jsp file should print all the vector objects from the "ReadAtts" bean
    Actual Output:
    Data after Parsing.......[]
    Thanks for your time.....
    Newton
    Bangalore. INDIA

    the problem is not because of java code insdie jsp page
    I have removed all things but the form and it is still not working
    here is the modified code:
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.print("addBTN");
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input name="addBTN" type="submit" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

  • Viewing document (blob) in JSP doesn't work

    I am currently supporting an application which talks to an Oracle 11gR1 database using several application servers. Our application is working on the following application servers:
    - Apache Tomcat 5 and 6
    - Oracle Application Server 10gR3
    - WebLogic (configuration 1)
    We have an second server which has WebLogic (configuration 2); however, we cannot get the JSP to display on that server. The same WAR file has been deployed to all four application servers, yet only the WebLogic Server configuration 2 doesn't work.
    WebLogic Server (configuration 2) appears to work (doesn't give an error message); however, the web-page tries to show a document (which appears to be a copy/representation of the existing HTML web page - i.e. a form filter screen). Any insight into the possible problem?
    The code we are using is shown below:
    public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws Exception {
    String fileIdString = request.getParameter("fileIdString");
    try {
    // Get the File to send to the client
    int fileId = Integer.parseInt(fileIdString);
    CustomFile file = fileService.loadFileById(fileId);
    if (file == null) {
    log.error("The fileId (" + fileId + ") could not be found - DNE.");
    int lastDot = file.getFilename().lastIndexOf('.');
    String fileExtension = (lastDot!=-1 ? file.getFilename().substring(lastDot) : "" );
    FileType fileType = fileService.loadByFileExtension(fileExtension);
    if (fileType == null) {
    log.error("The system could not find the file extension (" + fileExtension + ").");
    // Setup the response header so a file can be streamed to the client
    response.setHeader("Content-disposition", "attachment; filename=" + file.getFilename());
    response.setContentLength((int) file.getFile().length());
    response.setContentType(fileType.getWebContent());
    // Break the file down into its bytes so it can be streamed
    ServletOutputStream outputStream = response.getOutputStream();
    InputStream inputStream = file.getFile().getBinaryStream();
    byte[] buffer = new byte[2048];
    int bytesRead = inputStream.read(buffer);
    while (bytesRead >= 0) {
    if (bytesRead > 0) {
    outputStream.write(buffer, 0, bytesRead);
    bytesRead = inputStream.read(buffer);
    // Garbage collection
    outputStream.flush();
    outputStream.close();
    inputStream.close();
    return null;
    } catch (Exception exception) {
    log.error(exception.getMessage());
    return mapping.findForward("failure");
    We had a siimilar issue with some displaying RTF documents and the solution was to remove ALL whitespace characters in the JSP (which seemed to work). I don't see how we can remove the whitespace in the above ActionServlet code.
    Thanks in advance for the help!

    Hi Peter,
    Sorry i am not able to understand what u want to say.If u give some more details it will be useful.
    If i understand u correctly u want the button to be hidden initially and visible after some contidion becomes true right?
    If yes call a javascript function as soon as ur condition becomes true and inside that function make the span visible by writting the following code.
    document.getElementById('id of span').style.visibility='visible';
    Dont forget to give an id to span. it is necessary.
    U can use span itself no need of going for div
    If my view is wrong tell me detaily what is ur ultimate aim?
    Regards,
    Tamil K
    Message was edited by:
            Tamil Venthan

  • H:outputLink tag whitespace

    Hello,
    I've found that the <h:outputLink> tag, when rendering HTML, follows the closing </a> with lots of whitespace - some line breaks and tabs. I'm not sure if this problem is specific to the particular JSF implementation I'm using (WebSphere Portal v5.1 JSF Portlet).
    This is a problem because we need some of our links to be immediately followed by a period. With any whitespace there, the browser renders a single space between the link and the period.
    Any ideas on how to fix this?
    Thanks

    Adding the CSS style of "whitespace: normal;" doesn't really do anything, since it's the normal way the browser interprets whitespace - multiple continguous whitespace in the HTML gets rendered as a single space. What I need is to not have any spaces rendered.
    It's too bad there isn't a CSS style that makes whitespace in the HTML completely ignored.
    I'm still looking for a solution here. I could probably take out the h:outputLink tag and just use an <a href=" in my JSP, but I would much prefer to use a JSF tag if possible. Especially since this kind of situation appears in many places in our application.

  • Print in jsp page

    hi,
    I using jsp to develop webpage. From that i need to print a small size identity cards. while i design, it shows in corner of webpage and remain space are as whitespace.
    also i using print() in javascript to print.
    how to print a page with small size.?
    thanks in advance.,
    edi

    Couldnt U just use a while loop something like the following...
    <table>
    <%
    while(tree.next()){
    %>
    <tr>
    <td><%=tree.getString("output") %></td>
    <td><%=tree.getString("output2") %></td>
    </tr>
    <%
    } %>
    </table>
    or your version of that...
    Assuming U have Ur tree.next returning a false when it gets to the end.
    Hope I helped.
    - meMyselfAndI

  • Is is standard for JSP to output every newline character it sees?

    I've encountered a very annoying problem using JSP. It seems JSPC outputs every newline character it sees in the JSP page -- even if it is after a JSP comment or JSP directive. Look at the sample JSP at the bottom: it will output 4 blank lines (3 from comments + 1 from directive) before it prints "JSP Body Line 1". Granted, this is not a big problem if the content is HTML and will be viewed in a browser. However, my content has to be plain text because the client in my case is not always a browser.
    I've tested this on both JRun and TomCat. Same results. I don't understand why is this, because intuitively the JSP designer would not have meant to output those blank lines, right? I'm wondering if this is really an "official" behavior prescribed by the JSP standard, or just an oversight in JRun and TomCat? Could any expert help me verify this in JSP standard (by the way, which one is the official document that spells out the JSPC implementation?) or anyone help me test it in other App Server (e.g. WebLogic, WebSphere, etc.) which I don't have access to? Your help is greatly appreciated!
    ======= Sample JSP code ========
    <%-- JSP Comment Line 1 --%>
    <%-- JSP Comment Line 2 --%>
    <%-- JSP Comment Line 3 --%>
    <@ page contentType="text/plain" %>
    JSP Body Line 1
    JSP Body Line 2
    ...

    The truth is, newlines (as far as HTML or most XML is concerned) are just any old kind of whitespace. An extra line or two isn't a major problem, the only time this will really cripple you is if you want to insert scriptlets above the <?xml...> line.

  • Create XML using JSP

    I am trying to create and send an XML file back to browser where XSL will be
              applied. I am using wl6.0 sp2
              I tried like this
              <%@ page contentType="text/xml" %>
              <%
              out.println("<?xml version=\"1.0\"?>") ;
              out.println("<books>");
              out.println("<title>") ;
              out.println("XML Programming") ;
              out.println("</title>") ;
              out.println("</books>") ;
              %>
              But the browser is blank.
              Thanks
              shaikjava
              

    Also, valid XML documents have no whitespace before the <?xml ...?>
              declaration.
              Sam
              "Cameron Purdy" <[email protected]> wrote in message
              news:[email protected]...
              > There are lots of reasons why the browser could be blank. Judging from the
              > JSP you provided below, I could not even begin to guess at what you are
              > doing to prevent the browser from working.
              >
              > > <%
              > > out.println("<?xml version=\"1.0\"?>") ;
              > > out.println("<books>");
              > > out.println("<title>") ;
              > > out.println("XML Programming") ;
              > > out.println("</title>") ;
              > > out.println("</books>") ;
              > > %>
              >
              > Do you mean you did all that when you could have just:
              >
              > <?xml version="1.0"?>
              > <books>
              > <title>
              > XML Programming
              > </title>
              > </books>
              >
              > That is what JSPs are for, after all!!! Don't put markup language inside
              > code inside a JSP!!! You're going to give someone a friggin heart attack.
              >
              > Remember:
              > servlets = code
              > jsps = raw content
              >
              > You can put content in servlets by embedding it in the code. You can put
              > code in jsps by embedding it in the content.
              >
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol Inc.
              > << Tangosol Server: How Weblogic applications are customized >>
              > << Download now from http://www.tangosol.com/download.jsp >>
              >
              >
              > "chand" <[email protected]> wrote in message
              > news:[email protected]...
              > > I am trying to create and send an XML file back to browser where XSL
              will
              > be
              > > applied. I am using wl6.0 sp2
              > >
              > > I tried like this
              > >
              > > <%@ page contentType="text/xml" %>
              > >
              > > <%
              > > out.println("<?xml version=\"1.0\"?>") ;
              > > out.println("<books>");
              > > out.println("<title>") ;
              > > out.println("XML Programming") ;
              > > out.println("</title>") ;
              > > out.println("</books>") ;
              > > %>
              > >
              > > But the browser is blank.
              > >
              > > Thanks
              > > shaikjava
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              >
              >
              

  • I download itext  for convert jsp to PDF. How to set content type for PDF.

    I download itext for convert jsp to PDF. How to set content type for PDF. I try
    <%@ page contentType = "application/pdf;charset=TIS-620" %>
    , but the page does not PDF.
    Thank.

    PDF files are usually binary files, JSPs are not well-suited for binary content.
    (If you download the result of your JSP you'll see that it is not a valid PDF file; it will have probably a lot of whitespace and linefeeds, that will choke your PDF reader.). The first few characters must be
    "%PDF-" without whitespace.
    You can try using PDF files encoded as text - check if you can use text-encoded PDFs in iText.
    Try using a Servlet instead.

  • OC4J fails to compile jsp

    OC4J : canno't complie jsp Page : the oracle OracleJSP say "invalid flag : de"
    hello,
    I 've to deploy a J2EE web application with 10g application server (this application works fine with tomcat for the moment).
    The first time i access to my jsp page via oc4j , i have this error :
    oracle.jsp.provider.JspCompileException : compilation error
    :/home/oracle10/OraHome1/j2ee/home/application-deployments/Gifco/Gifco/persistence/_pages/_web_2d_inf/_jsp/_cadre.java
    invalid flag: de
    i guess there is a file access problem but if someone knows what means this error...
    regards
    Version :
    Operating System and Version: Red Hat AS 3
    Product (i.e., OAS, IAS, etc): IAS
    Product Version: 10g (9.0.4)
    JDK Version: java version "1.4.2_02"

    You may have run into bug 3498079.
    Here is rediscovery:
    Install oc4j_extended.zip to a location which has a long absolute path name and whitespaces in it(e.g. /tmp/test 1/test lasspath/testwhitespace/). Shorter absolute path may not reproduce the problem. Or add more jar libraries in &lt;library path&gt; tag in j2ee/home/applications.xml.
    Both cases would cause compilation error.
    This bug is fixed in 9.0.4 and (I assume you are not
    on that version) you could upgrade to it.
    I hope this helps.

  • Optimizing jsp (struts)

    I am having problem with following jsp. Its taking very less time to load the data from database(using struts action class at backend) and the control is coming back to the browser soon , but its taking a long time to display the contents in the browser. What may be the issue. The jsp is as follows. It has lot of list boxes with huge data. Is there any way to optimize this page so that it loads faster.
    <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
    <%@ taglib uri="/tags/struts-html" prefix="html" %>
    <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
    <%@ page buffer="24kb" %>
    <jsp:include page="../header.jsp" ></jsp:include>
    <SCRIPT LANGUAGE="JavaScript">
    function submitThisForm(thisElem) {
    var verValue = thisElem.form.version.value;
    thisElem.form.version.value = trim(verValue);
    verValue = thisElem.form.version.value;
    var osTypeValue = thisElem.form.osType.value;
    var osFunValue = thisElem.form.osFunction.value;
    if (verValue.length != 0) {
    if ((osTypeValue == "" || osTypeValue == null) && (osFunValue == "" || osFunValue == null)) {
    alert ("Please select OS Type and Function");
    thisElem.form.osType.focus();
    return false;
    } else if (osTypeValue == "" || osTypeValue == null) {
    alert ("Please select OS Type");
    thisElem.form.osType.focus();
    return false;
    } else if (osFunValue == "" || osFunValue == null) {
    alert ("Please select Function");
    thisElem.form.osFunction.focus();
    return false;
    if(thisElem.form.memcheckVal.value.length > 0) {
    var val=thisElem.form.memcheckVal.value.match(/^\d+$/);
    if(val == null) {
    alert("Enter numeric value for memory");
    thisElem.form.memcheckVal.focus();
    return false;
    if(thisElem.form.flashcheckVal.value.length > 0) {
    var val=thisElem.form.flashcheckVal.value.match(/^\d+$/);
    if(val == null) {
    alert("Enter numeric value for flash");
    thisElem.form.flashcheckVal.focus();
    return false;
    return true;
    // Trim whitespace from left and right sides of s.
    function trim(s) {
    return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
    </SCRIPT>
    <!-- START OF PAGE -->
    <%
    String custId = request.getParameter("custId");
    String cpyKey = request.getParameter("cpyKey");
    System.out.println("Entered JSP Scriplet ");
    System.out.println("Buffer size is --"+ response.getBufferSize());
    %>
    <br/>
    <p class="note">
    <strong>Simple Config Search: </strong> This option will search the configuration files for keywords, allowing the ability to use AND/OR and NOT between lines. No wild cards are allowed, however this is a fast way of finding a keyword in a configuration file.
    <br/><br/>
    <strong>Regular Expression Config Search: </strong><br/>
    This option will search the configuration files, (line by line) using egrep. Therefore all expressions as
    supported by egrep, are supported here.
    <br/><br/>
    <strong>Combined Simple and Regular Expression Config Search: </strong><br/>
    Use the combined search for faster search results. It will search the whole document first with the
    Simple Search criteria (fast) and then pass the results on for Regular Expression matching (slow).
    </p>
    <p class="note">
    <strong>Note:</strong><br/>
    The search does an 'AND' between rows and an 'OR' on the fields inside each row.<br/> To select more than one in each row press 'CNTRL' key .
    <br/><br/>
    <strong>Device Name Pattern:</strong><br/>
    Enter a pattern for device names using '*' only.<br/>
    If device name is chosen from list "Device Names" above it, then that shall take precedence.
    <br/><br/>
    <strong>Chassis Serial Number:</strong><br/>
    Multiple patterns should be separated by a comma
    </p>
    <html:form action="/srchAction.do">
    <html:hidden property="custId" value="<%=custId%>"/>
    <html:hidden property="cpyKey" value="<%=cpyKey%>"/>
    <div class="tableholder" title="Name Or Describe The Form here">
    <table border="0" cellpadding="3" cellspacing="5">
    <tr>
    <td>
    <label for="swish">Simple Config Search</label>
    </td>
    <td>
    <html:text property="swish" size="45"/>
    </td>
    </tr>
    <tr>
    <td>
    <label for="rcsrch">Regex Config Search</label>
    </td>
    <td>
    <html:text property="regex" size="45"/>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <br/>    
    <input class="buttonpos" type="submit" name="search" value="Search" />
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="groupNameId">Groups</label>
    </td>
    <td>
    <html:select property="groupNameId" multiple="true" size="4">
    <option value="any" selected>Any</option>
    <%
    %>
    <html:optionsCollection name="GROUP_LIST" value="groupId" label="groupName" />
    <%
    %>
    </html:select>
    <br/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="deviceNameId">Device Names</label>
    </td>
    <td>
    <html:select property="deviceNameId" multiple="true" size="4">
    <option value="any" selected>Any</option>
    %>
    <html:optionsCollection name="DEVICE_LIST" value="deviceId" label="deviceName" />
    <%
    %>
    </html:select>
    <br/><br/>
    <label for="text" value="">Pattern </label>
    <html:text property="deviceNamePat" size="20"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="os">SW Version</label>
    </td>
    <td>
    <html:select size="4" property="os" multiple="true">
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="osValues" />
    </html:select>
    <br/><br/>
    <label for="major" value="">Maj Ver </label><html:text property="major" value="*" size="2"/>
    <label for="minor" value="">Min Ver </label><html:text property="minor" value="(*)" size="2"/>
    <label for="release" value="">Release Train </label><html:text property="release" value="*" size="2"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="hostnames">Version Function</label>
    </td>
    <td>
    <label for="version" value="">Version </label><html:text property="version" size="20"/><br/>
    <label for="osType" value="">OS Type </label>
    <html:select property="osType">
    <html:option value=""> </html:option>
    <html:option value="IOS">IOS</html:option>
    <html:option value="CatOS">CatOS</html:option>
    </html:select>
    <br/>
    <label for="osFunction" value="">Function </label>
    <html:select property="osFunction">
    <html:option value=""> </html:option>
    <html:option value="releaseGreater">releaseGreater (Full Version Greater)</html:option>
    <html:option value="releaseGreaterEqual">releaseGreaterEqual (Full Version GreaterEqual)</html:option>
    <html:option value="releaseLesser">releaseLesser (Full Version Lesser)</html:option>
    <html:option value="releaseLesserEqual">releaseLesserEqual (Full Version LesserEqual)</html:option>
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="hwfam">HW Family</label>
    </td>
    <td>
    <html:select size="4" property="hwfam" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="hwfamValues" />
    </html:select>
    <br/><br/>
    <label for="hwfamPattern" value="">Pattern </label>
    <html:text property="hwfamPattern" value="*" size="20"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="pid">Chassis Product ID</label>
    </td>
    <td>
    <html:select size="4" property="pid" multiple="true">
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="pidValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="hwchass">Chassis SNMP Name</label>
    </td>
    <td>
    <html:select size="4" property="hwchass" multiple="true">
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="hwchassValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="tech">Technology</label>
    </td>
    <td>
    <html:select size="4" property="tech" multiple="true">
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="techValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="features">Features</label>
    </td>
    <td>
    <html:select size="4" property="features" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="featValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="cfam">Module Family</label>
    </td>
    <td>
    <html:select size="4" property="cfam" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="cfamValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="cfam">Module Product ID</label>
    </td>
    <td>
    <html:select size="4" property="cardspid" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="cardPidValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="cards">Module SNMP Name</label>
    </td>
    <td>
    <html:select size="4" property="cards" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="cardsValues" />
    </html:select>
    <br/><br/>
    <label for="cardPattern" value="">Pattern </label>
    <html:text property="cardPattern" value="*" size="20"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="inffam">Interface Family</label>
    </td>
    <td>
    <html:select size="4" property="inffam" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="inffamValues" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="infs">Interfaces</label>
    </td>
    <td>
    <html:select size="4" property="infs" multiple="true" >
    <option value="any" selected>Any</option>
    <html:options name="INV_DETAILS" property="infsValues" />
    </html:select>
    <br/><br/>
    <label for="interfacePattern" value="">Pattern </label>
    <html:text property="interfacePattern" value="*" size="20"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="srlNumPattern">Chassis Serial Number</label>
    </td>
    <td>
    <html:text property="srlNumPattern" value="*" size="45"/>
    </td>
    </tr>
    <tr>
    <td colspan="2"><div class="horizontalgraydots"></div></td>
    </tr>
    <tr>
    <td>
    <label for="memopVal">Memory</label>
    </td>
    <td>
    <html:select property="memopVal" size="1">
    <html:option value="gt">></html:option>
    <html:option value="lt"><</html:option>
    <html:option value="gte">>=</html:option>
    <html:option value="lte"><=</html:option>
    <html:option value="eq">=</html:option>
    </html:select>
    <html:text property="memcheckVal" size="8"/> MB
    </td>
    </tr>
    <tr>
    <td>
    <label for="flashopVal">Flash</label>
    </td>
    <td>
    <html:select property="flashopVal" size="1">
    <html:option value="gt">></html:option>
    <html:option value="lt"><</html:option>
    <html:option value="gte">>=</html:option>
    <html:option value="lte"><=</html:option>
    <html:option value="eq">=</html:option>
    </html:select>
    <html:text property="flashcheckVal" size="8"/> MB
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <br/>    
    <input class="buttonpos" type="submit" name="search" value="Search" onclick="return submitThisForm(this);"/>
    </td>
    </tr>
    </table>
    </div>
    </html:form>
    <!-- END OF PAGE -->
    <jsp:include page="../footer.jsp"></jsp:include>

    <link rel='stylesheet' type='text/css' href="../stylesheets/common.css">
    The problem will be caused by the relative link to your stylesheet
    If your jsp page is /subdirectory/jsppage.jsp
    and your form is submitted to /controlServlet
    it looks for the css file relative to /controlServlet - ie it won't find it from here.
    There are two solutions.
    If your stylesheets can be accessed via absolute reference, make it so
    ie <link rel='stylesheet' type='text/css' href="/stylesheets/common.css">
    Thus you use only absolute references, and no relative links
    The other solution: to use relative links, you have to specify a base.
    <base href="reference to your jsp page\">

Maybe you are looking for

  • Critique my Setup - suggestions please!!!

    Hi all. I'm new to this forum and hopefully some of you can help me. We have a photography business and recently bought a new custom built PC. It has the following specs: Intel Core 2 Duo (Extreme Performance) Platform Asus P5KC Core 2 Quad/ Intel P3

  • LabVIEW not reading data correctly

    I'm new to LabVIEW (using it for a subject at university) but I've coded up a short program that counts rising and falling edges of a signal (to be used with input of a quadrature encoder). I've tested it at low frequency using the Simulate Signal bl

  • LDAP Groups Performance

    I am planning LDAP authentication for a portal and am looking at assign LDAP groups to portal roles to ease user administration because there will be a signifigant amount of users. I've done this before with smaller amounts of users, but have heard c

  • What gives? I uncheck "Reopen windows when logging out" and it still goes back to the prev. sessions windows.  Is there a fix for this?

    What gives? I uncheck "Reopen windows when logging out" and it still goes back to the prev. sessions windows.  Is there a fix for this?

  • Can't change icon theme in XFCE4 [never mind]

    Hi, I downloaded few xfwm, cursor and icon themes and they all work except icon... I followed steps at http://wiki.xfce.org/howto/install_new_themes and Arch Wiki but that's not solution when case are icon themes... thanks. Edit: Okay, I just checked