Using JSTL to display space conditionally

Hi,
I need to use JSTL to insert a space when the value of a particular variable is null.
The obvious approach would be to use the following code:
<c:choose>
<c:when test="${var} != null">${var}</c:when>
<c:otherwise> </c:otherwise>
</c:choose>
OR
${var} <c:if test="$var== null}">  </c:if>
However, i need to do this in a lot of places ( a number of table cells to be precise) and the above code looks bulky to be inserted everywhere.
I read the JSTL documentation and found that the following code can also be used:
<c:out value='${var}' default=" " />
As per JSTL documetation, the default will be used if the variable has a null value and hence the above code should work theoretically.
My problem is that whenever the value of the variable is null, the output is   and not a space. i.e. actually the text   is displayed. Is there some way of getting the space to display?
Or is there any other alternative to condinally insert a space without having to write the bulky <c:choose> OR <c:if> code?
Thanks in advance.

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:set var="myDb"  value="${sessionScope.testDataBean}" />
<html>
<head></head>
<body>
      <c:choose>
       <c:when test="${myDb != null}" >
          <c:forEach var="hashMapAsRow" items="${myDb}" varStatus="lineInfo">
           <tr>
               <td><c:out value="${hashMapAsRow['column1']}" /></td>
             <td><c:out value="${hashMapAsRow['column2']}" /></td>
            </tr>
     </c:forEach>
      </c:when>
      <c:otherwise>
     <tr><td colspan="100%">No Data Exists</td></tr>
      </c:otherwise>
    </c:choose>
</body>
</html> or the one below
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head></head>
<body>
      <c:choose>
       <c:when test="${sessionScope.testDataBean != null}" >
          <c:forEach var="hashMapAsRow" items="${sessionScope.testDataBean}" varStatus="lineInfo">
           <tr>
               <td><c:out value="${hashMapAsRow['column1']}" /></td>
             <td><c:out value="${hashMapAsRow['column2']}" /></td>
            </tr>
     </c:forEach>
      </c:when>
      <c:otherwise>
     <tr><td colspan="100%">No Data Exists</td></tr>
      </c:otherwise>
    </c:choose>
</body>
</html> is this the one which you are looking for ??
REGARDS,
RaHuL

Similar Messages

  • Question | Using JSTL to Display elements of an ArrayList of HashMaps

    Hi All,
    I would like some advice on the following code snippet which is a representation of my real code. Please see below for the code snippet and the specific questions I have.
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%
    // This Object is an ArrayList of HashMaps
    MyClassDataBean myDb =  (MyClassDataBean)session.getAttribute("testDataBean");
    // Adding myDb to the pageContext so that EL can be used to render components in this Object
    pageContext.setAttribute("myDb",myDb);
    pageContext.setAttribute("column1",MyConstants.COLUMN1);
    pageContext.setAttribute("column2",MyConstants.COLUMN2);
    %>
    <html>
    <head></head>
    <body>
         <c:choose>
          <c:when test="${myDb != null}" >
             <c:forEach var="hashMapAsRow" items="${myDb}" varStatus="lineInfo">
              <tr>
                  <td><c:out value="${hashMapAsRow[column1]}" /></td>
               <td><c:out value="${hashMapAsRow[column2]}" /></td>
               </tr>
         </c:forEach>
         </c:when>
         <c:otherwise>
         <tr><td colspan="100%">No Data Exists</td></tr>
         </c:otherwise>
       </c:choose>
    </body>
    </html>Question: Is there an alternative to accessing elements using the core tag library in this Object without using pageContext.setAttribute() ? If not, would the c_rt library be better to use in this scenario? If so, could someone give me an example of the right way to use it based on the above example?
    Thanks,
    Joe

    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <c:set var="myDb"  value="${sessionScope.testDataBean}" />
    <html>
    <head></head>
    <body>
          <c:choose>
           <c:when test="${myDb != null}" >
              <c:forEach var="hashMapAsRow" items="${myDb}" varStatus="lineInfo">
               <tr>
                   <td><c:out value="${hashMapAsRow['column1']}" /></td>
                 <td><c:out value="${hashMapAsRow['column2']}" /></td>
                </tr>
         </c:forEach>
          </c:when>
          <c:otherwise>
         <tr><td colspan="100%">No Data Exists</td></tr>
          </c:otherwise>
        </c:choose>
    </body>
    </html> or the one below
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <head></head>
    <body>
          <c:choose>
           <c:when test="${sessionScope.testDataBean != null}" >
              <c:forEach var="hashMapAsRow" items="${sessionScope.testDataBean}" varStatus="lineInfo">
               <tr>
                   <td><c:out value="${hashMapAsRow['column1']}" /></td>
                 <td><c:out value="${hashMapAsRow['column2']}" /></td>
                </tr>
         </c:forEach>
          </c:when>
          <c:otherwise>
         <tr><td colspan="100%">No Data Exists</td></tr>
          </c:otherwise>
        </c:choose>
    </body>
    </html> is this the one which you are looking for ??
    REGARDS,
    RaHuL

  • How can i display the values in the vector in a jsp using jstl

    in a task i am recieving a vector in a jsp... how can i display those vector values in the jsp using jstl.... plz help me
    thanks in advance

    <%
    here you got vector say; v
    pagecontext.setAttribute("varname",v);
    %>
    <c:forEach var="i" items="${varname}">
    <c:out value="${i}">
    </c:forEach>

  • Displaying a set of records using jstl

    hi i am new to jstl.my requirement is i want to display a set of records from my database using jstl.for eg i want to display 50 records per page and i want to navigate to other records using next and prevoius buttons and i need to put view and edit buttons in that page.can anybody give me a solution for this.urgent

    You may try the paging taglib ...
    http://www.servletsuite.com/servlets/pagertag.htm

  • How to send object arraylist from servlet to jsp and display using jstl

    Hi All....
    I have a simple application and problem with it.
    Once user logged in to system the user will redirect to LoginServlet.java controller.
    Then in LoginServlet I want to redirect user to another page called book_details.jsp.
    this is my login servlet.
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              PrintWriter out = response.getWriter();
              ArrayList<BankAccountDTO> account_list = new ArrayList();
              ResultSet resultSet = null;
              LowFairAirDB airDB = null;
              try{
                   airDB = new LowFairAirDB();
                   String query = "SELECT account_id, type, description, balance, credit_line, begin_balance, begin_balance_time_stamp FROM bank_account";
                   airDB.sqlSelect(query);
                   resultSet = airDB.getResultSet();
                   while(resultSet.next()){
                        account_list.add(new BankAccountDTO(resultSet.getInt(1),
                                                                     resultSet.getInt(4),
                                                                     resultSet.getInt(5),
                                                                     resultSet.getInt(6),
                                                                     resultSet.getString(2),
                                                                     resultSet.getString(3),
                                                                     resultSet.getString(7)));
              }catch(Exception ex){
              }finally{
                   try{resultSet.close();}catch(Exception ex){}
                   airDB.sqlClose();
         }I set bank account values to BankAccountDTO.java objects and add them to the arrayList.
    Next I want to send this objects arrayList to books_details.jsp and wanna display each objects values using JSTL.
    I still finding a way to go through this.
    1. Can anyone say how can I do it?
    2. Is there any other method to do the same thing without using JSTL?
    thanks in advance,
    Dil.

    Naishe wrote:
    In your servlet,
    request.setAttribute("account_list", account_list);
    requestDispatcher.findForward("/your/display/jsp");
    Good. I would only follow the Java naming conventions. E.g. accountList or accounts instead of the ugly PHP/C conventions.
    In the JSP,
    lst = (List< BankAccountDTO >)request.setAttribute("account_list");
    for(BankAccountDTO b: lst){
    populate your HTML tags or whatever
    Wrong. 1) You need getAttribute() and 2) you should not use scriptlets. Use JSTL c:forEach, e.g.<table>
        <c:forEach items="${accounts}" var="account">
            <tr>
                <td>${account.id}</td>
                <td>${account.type}</td>
                <td>${account.description}</td>
            </tr>
        </c:forEach>
    </table>To the topicstarter: for future JSP/JSTL related questions please use JSP/JSTL forum.
    Here it is: [http://forums.sun.com/forum.jspa?forumID=45].

  • Posting huge data on to JSP page using JSTL tags

    Hi,
    I have one application where I have to post huge data (approximately 2000 rows of data) into JSP page. I am using JSTL tags and running on Tomcat 5.
    It is taking almost 20 to 25 seconds to load the entire page.
    Is it the optimal time to load or it could be improved?
    Please let me know.
    Thanks,
    --Subbu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Evnafets,
    Thank you for the response.
    Here are the tasks I am doing to display the data on JSP.
    0. We are running on Tomcat 5 and the memory size is 1024MB (1GB).
    1. Getting the data - I am not performing any database queries. The data is stored in the static cache memory. So the server side response is so quick - less than a milli second.
    2. Using Java beans to pass data to the presentation layer (JSP).
    3. 10 'if' conditions and 2 'for' loops and 2 'choose' statements are being used in the JSP page while displaying the data.
    4. Along with the above, there are 4 javascript files are being used.
    5. The jsp file size after rendering the data, is aprox. 160 kb
    Hope this information helps you to understand the problem.
    Thanks,
    --Subbu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Re: [iPlanet-JATO] Re: using begin childName Display method

    Steve,
    It sounds like you have your display fields in a container view, and
    that container view is inside of a view bean. I haven't tested whether
    the fireChildDisplayEvents has a "deep" effect on its container view
    children. Meaning that you may have to set fireChildDisplayEvents="true"
    for the <jato:containerView> tag instead. If all else fails and you need
    to just get it working, you can set the fireDisplayEvents="true" for
    each display field tag separately.
    craig
    stephen_winer wrote:
    I should clarify my earlier statement. The data I want to display is
    coming from a model (tied in in the createChild method). I want to
    conditionally reformat the text that is being substituted in the JSP
    for a JATO form element, but I want this to happen on the server, not
    with JavaScript. The begin<childName>Display and
    end<childName>Display methods allow me to do this, in theory, but I
    can not get them to execute.
    Steve
    --- In iPlanet-JATO@y..., Belinda Garcia <belinda.garcia@s...> wrote:
    I don't currently use a begin or end Display method. I merely bind
    the fields to
    the model when the child is created and use the setValue to
    initially set the
    value to what's in the model. I get nulls though if I try to use a
    tiled View. I
    haven't quite got this figured out.
    Belinda
    X-eGroups-Return:
    sentto-2343287-1135-1008613974-belinda.garcia=sun.com@r...
    X-Sender: stephen_winer@y...
    User-Agent: eGroups-EW/0.82
    From: "stephen_winer" <stephen_winer@y...>
    X-Originating-IP: 155.188.191.4
    X-Yahoo-Profile: stephen_winer
    Mailing-List: list iPlanet-JATO@y...; contact
    iPlanet-JATO-owner@y...
    Date: Mon, 17 Dec 2001 18:32:48 -0000
    Subject: [iPlanet-JATO] using begin<childName>Display method
    Content-Transfer-Encoding: 7bit
    I want to be able to conditionally show/hide data as well as
    format
    it for display without touching the model. I found the
    begin<childName>Display and end<childName>Display methods that
    provide the hooks to do this, but I have been unsuccessful in
    getting
    these method to execute. I added the
    fireChildDisplayEvents="true"
    attribute to the jato:useViewBean tag, but this has not helped.
    I
    also added some debug to the ContainerViewBase class in the
    public
    boolean beginChildDisplay(ChildDisplayEvent event) method to see
    what
    was happening. The displayMethodMap was returning null for the
    child
    display methods that were in the view bean. I covered all the
    bases
    (compiling, redeploying, etc.) and nothing has worked. Is there
    anything I am missing or is there some working example of this?
    Steve
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    >For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp

    The hidden field was present in the page, but it looked like this:
    <input type="hidden" name="jato.defaultCommand" value=""../search"">
    Seems like there is a small bug in the code generating this tag.
    FYI - I am using JATO1.2
    What file displays this text? Maybe I can go in and fix it and rejar
    it.
    Steve
    --- Mike Frisino wrote:
    Steve,
    Can you check the HTML source that shows up in the browser? Do you see an entry that looks like this at the bottom of the form in
    question?
    >
    <input type="hidden" name="jato.defaultCommand" value="/search">
    To answer your question - it should work as you described. Some of the JatoSample make use of the defaultCommandChild. Can you try
    running the sample BasicSample->Field Types and let us know what you
    see.
    >
    Failing this you can send me your jsp file , maybe there is some subtle issue there. michael.frisino@s...
    >
    >
    ----- Original Message -----
    From: stephen_winer
    Sent: Friday, December 07, 2001 8:05 AM
    Subject: [iPlanet-JATO] Using the defaultCommandChild in a form
    I am trying to set the defaultCommandChild in my jato:form tag to be
    the searcg button. The search button definition is:
    <jato:button name="search"/>.
    The form tag definition is:
    <jato:form name="PendingIA" defaultCommandChild="/search">
    Clicking on the search button works fine, but hitting return in one
    of the textFields (which submits the form) passes a value of "" to
    the createChild method in my viewBean, which throws an error. Why
    does this not just work as normal and trigger the handleSearchRequest
    () method?
    Steve
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    Service.
    >
    >
    >
    [Non-text portions of this message have been removed]

  • Re: [iPlanet-JATO] using begin childName Display method

    Oops. Sorry about that, Craig. I didn't realize I might leave that impression.
    I'm sure the tiled
    views work since you have so many examples of these and it's a relatively
    simple concept, isn't it?
    Not to mention a necessary one. I didn't have time to debug my code and find
    out what I was doing
    wrong where the tiled views are concerned. I decide to just try to implement
    tiled views later and
    just stick with one of everything for now and get that working.
    Yes, I have reviewed your comments and am taking them into consideration. I am
    able to save and
    retrieve values with my model at this point.
    Thanks.
    Belinda
    X-eGroups-Return:
    sentto-2343287-1143-1008622698-belinda.garcia=sun.com@r...
    X-Sender: craig.conover@s...
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4)Gecko/20011019 Netscape6/6.2
    X-Accept-Language: en-us
    From: "Craig V. Conover" <craig.conover@s...>
    X-Yahoo-Profile: cvconover
    Mailing-List: list [email protected]; contact
    [email protected]
    Date: Mon, 17 Dec 2001 13:00:10 -0800
    Subject: Re: [iPlanet-JATO] using begin<childName>Display method
    Content-Transfer-Encoding: 7bit
    Belinda,
    He may also be binding the models, howerver, he needs to change the way
    the value appears before it is displayed which is why you would use the
    display events.
    Your null value issue is a completely different issue and has nothing to
    do with it being a tiled view. I don't want anyone getting the idea
    that the tiledView binding is broken. It does work. You issue should
    have something to do with the inconsistent way in which you are getting
    your model. At least from what I could tell in your source code that you
    sent me.
    Have you reviewed my comments I sent to you in your source code?
    craig
    Belinda Garcia wrote:
    I don't currently use a begin or end Display method. I merely bind the
    fields to
    the model when the child is created and use the setValue to initially setthe
    value to what's in the model. I get nulls though if I try to use a tiledView. I
    haven't quite got this figured out.
    Belinda
    X-eGroups-Return:
    sentto-2343287-1135-1008613974-belinda.garcia=sun.com@r...
    X-Sender: stephen_winer@y...
    User-Agent: eGroups-EW/0.82
    From: "stephen_winer" <stephen_winer@y...>
    X-Originating-IP: 155.188.191.4
    X-Yahoo-Profile: stephen_winer
    Mailing-List: list [email protected]; contact
    [email protected]
    Date: Mon, 17 Dec 2001 18:32:48 -0000
    Subject: [iPlanet-JATO] using begin<childName>Display method
    Content-Transfer-Encoding: 7bit
    I want to be able to conditionally show/hide data as well as format
    it for display without touching the model. I found the
    begin<childName>Display and end<childName>Display methods that
    provide the hooks to do this, but I have been unsuccessful in getting
    these method to execute. I added the fireChildDisplayEvents="true"
    attribute to the jato:useViewBean tag, but this has not helped. I
    also added some debug to the ContainerViewBase class in the public
    boolean beginChildDisplay(ChildDisplayEvent event) method to see what
    was happening. The displayMethodMap was returning null for the child
    display methods that were in the view bean. I covered all the bases
    (compiling, redeploying, etc.) and nothing has worked. Is there
    anything I am missing or is there some working example of this?
    Steve
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp

    The hidden field was present in the page, but it looked like this:
    <input type="hidden" name="jato.defaultCommand" value=""../search"">
    Seems like there is a small bug in the code generating this tag.
    FYI - I am using JATO1.2
    What file displays this text? Maybe I can go in and fix it and rejar
    it.
    Steve
    --- Mike Frisino wrote:
    Steve,
    Can you check the HTML source that shows up in the browser? Do you see an entry that looks like this at the bottom of the form in
    question?
    >
    <input type="hidden" name="jato.defaultCommand" value="/search">
    To answer your question - it should work as you described. Some of the JatoSample make use of the defaultCommandChild. Can you try
    running the sample BasicSample->Field Types and let us know what you
    see.
    >
    Failing this you can send me your jsp file , maybe there is some subtle issue there. michael.frisino@s...
    >
    >
    ----- Original Message -----
    From: stephen_winer
    Sent: Friday, December 07, 2001 8:05 AM
    Subject: [iPlanet-JATO] Using the defaultCommandChild in a form
    I am trying to set the defaultCommandChild in my jato:form tag to be
    the searcg button. The search button definition is:
    <jato:button name="search"/>.
    The form tag definition is:
    <jato:form name="PendingIA" defaultCommandChild="/search">
    Clicking on the search button works fine, but hitting return in one
    of the textFields (which submits the form) passes a value of "" to
    the createChild method in my viewBean, which throws an error. Why
    does this not just work as normal and trigger the handleSearchRequest
    () method?
    Steve
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    Service.
    >
    >
    >
    [Non-text portions of this message have been removed]

  • How to use the Columns Hidden | space in the bottom of af:panelCollection?

    Hi,experts,
    In jdev 11.1.2.3,
    I can see a row of Columns Hidden | Columns Frozen in the bottom of component af:panelCollection - pc1 which have an af:table - t1 component inside in designer view,
    and can see there is a blank row space only with "|" inside when the page is running.
    Now I want to use this blank row space such as to display row numbers for the table, so I set the property for the panelColletion as following source code:
    ==========================
    <af:panelCollection id="pc1" inlineStyle="width:1250px; height:500px;">
    <f:facet name="menus"/>
    <f:facet name="toolbar"/>
    <f:facet name="statusbar">
    <af:group id="g4"/>
    </f:facet>
    <af:table value="#{bindings.TView1.collectionModel}" var="row"
    rows="#{bindings.TView1.rangeSize}"
    emptyText="#{bindings.TView1.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.TView1.rangeSize}" rowBandingInterval="1"
    filterModel="#{bindings.ImplicitViewCriteriaQuery.queryDescriptor}"
    queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}" filterVisible="false"
    varStatus="vs"
    selectedRowKeys="#{bindings.TView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.TView1.collectionModel.makeCurrent}"
    rowSelection="single" id="t1" inlineStyle="font-size:xx-large; font-weight:bolder;">
    <af:column sortProperty="#{bindings.TView1.hints.GoodsStatus3.name}" filterable="true"
    sortable="true"
    headerText="#{bindings.TView1.hints.GoodsStatus3.label}"
    id="c42">
    <af:outputText value="#{row.GoodsStatus3}" id="ot33"/>
    </af:column>
    <f:facet name="footer">
    <af:group id="g3">
    *<af:outputText value="RowsNumber:" id="ot44"/>*
    *<af:outputText value="#{bindings.TView1Iterator.estimatedRowCount}"*
    id="ot43" partialTriggers="::pc1:t1"/>
    </af:group>
    </f:facet><f:facet name="detailStamp"/>
    </af:table>
    </af:panelCollection>
    =====================
    but when run the page there is no display for the row number, instead on the bottom of the table, there is only a blank row with "|" inside.
    How to use the Columns Hidden | Columns Frozen space in the bottom of component af:panelCollection ?
    Thanks!

    Hi, Arun
    It works.
    As in my use case, can draw an af:toolbar component into statusbar of Panel Collection facets in Structure view.
    There is still a small issue:
    cannot see the Columns Hidden|Columns Frozen component in the Structure view,
    and if drop more than one af:toolbar into statusbar, the sencond one will fall/wrap into second row, even though there is enough space on the first row (to occupy a second row in statusbar will be a waste of space), and cannot see how to adjust.
    Thank you very much!
    bao

  • Problem while parsing xmlString in jsp using JSTL

    HI, I am not able to display data in jsp page that I have stored in string variable in XML form.
    I want to print xmlString data in jsp using jstl.
    probably i might have to parse it but i don't have idea . Can any one help me PLZ??

    I managed the code but getting following error
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Content is not allowed in prolog.
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Content is not allowed in prolog.
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.xml.test_jsp._jspService(test_jsp.java:106)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
         com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSource(ParseSupport.java:227)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSourceWithFilter(ParseSupport.java:193)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseReaderWithFilter(ParseSupport.java:199)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseStringWithFilter(ParseSupport.java:206)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.doEndTag(ParseSupport.java:138)
         org.apache.jsp.xml.test_jsp._jspx_meth_x_parse_0(test_jsp.java:168)
         org.apache.jsp.xml.test_jsp._jspService(test_jsp.java:82)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • Problem using jstl and displaytags

    Hi all,
    I am using display tags taglib for generation of table. One of the columns has to be shown with the hyperlink attached to it. In order to acheive this i am using jstl taglib together with displaytags
    <display:table name="reportList" id="row" requestURI="viewengagementstatus.do" style="width: 100%;">
    <display:column  title="Period"  sortable="true" style="text-align:  center;" >
    <a href="/jsps/reportsummary.do?eid=<c:out value="${row.eid}" />&reportId=<c:out value="${row.ReportID}" />&reportPeriod=<c:out value="${row.targetDate}"/> " target="_blank"><font size="1"><c:out value="${row.targetDate}"/></font></a>
    </display:column>I am using jstl1.1.2.jar for jstl.
    When i run this on Weblogic10 and windows OS i am able to view the results. On performing the view source on the IE window, i get the following:
    <td style="text-align:  center;">
                   <a href="/jsps/reportsummary.do?eid=78004&reportId=104093&reportPeriod=Nov-2008 " target="_blank"><font size="1">Nov-2008</font></a>
    </td>but when the same code is run on the Weblogic deployed on the Linux machine, i am not getting the links and the name:
    the view-source of the application deployed on the linux machine shows:
    td style="text-align:  center;">
                   <a href="/jsps/reportsummary.do?eid=&reportId=&reportPeriod=" target="_blank"><font size="1"></font></a>
    </td>Any Ideas why this is occuring?
    Any help would be appreciated

    You should be using the one or the other, not both. Since your actual code shows that you don't need the jstl/core_rt taglib (you're using the JSP EL ${ } in JSTL tags rather than scriptlets <%= %> ), just remove that taglib declaration and continue using the jstl/core taglib.
    You should also rather place both the JSTL and standard JAR in the classpath of the application server. In case of Tomcat, put it in its /lib directory. Then remove all unnecessary JSTL and Standard JAR and TLD files from your whole webapplication project and also remove any related entries from the web.xml of your webapplication project. To use JSTL you only need to put the JAR files in the classpath of the application server and define the taglib in your JSP. Nothing less and nothing more. If you're using JSTL 1.2 rather than JSTL 1.1, then you need to remove the standard.jar file too since it is already merged in the jstl-1.2.jar file.
    Oh, the web.xml should also be declared that way that the application server uses at least servlet 2.4.

  • JSP Worked Well Using Scripting Elements, But, Becomes a Null Using JSTL

    I have to bother all of you again with my JSTL problems. I am working on a JSP, which is very similar to the one that caused a lengthy discussion on this forum before. This JSP is a bit more complicated.
    Again, this JSP worked well and displayed what I expected when the page was coded using the scripting elements.
    I tried to use JSTL where possible and managed to correct all the compilation errors.
    Now, I got a simple message: 'null' in the browser without any explanation - typical problem working with JSP: very difficult to debug.
    I have tried to identify problems "one by one" and found the first encounter is where I want to set the background color for each row inside the <c:forEach ....> tag.
    I examined the code again and again, I could not see what would lead to 'null'. I need a hand again.
    <%@ taglib uri="/tags/struts-html-el" prefix="html" %>
    <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
    <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
    <%@ taglib uri="/tags/tiles" prefix="tiles" %>
    <%@ taglib uri="/tags/request" prefix="req" %>
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    <%@ page import="org.apache.artimus.message.utility.ParamUtil" %>
    <%@ page import="org.apache.artimus.message.exceptions.AssertionException" %>
    <%@ page import="org.apache.artimus.authorization.OnlineUser" %>
    <%@ page import="org.apache.artimus.authorization.OnlineUserImpl" %>
    <%@ page import="org.apache.artimus.filter.EnableEmotionFilter" %>
    <%@ page import="org.apache.artimus.message.ThreadBean" %>
    <%@ page import="org.apache.artimus.message.PostBean" %>
    <%@ page import="org.apache.artimus.message.AttachmentBean" %>
    <%@ page import="org.apache.artimus.MessageInboxConfig" %>
    <%@ page import="org.apache.artimus.WebSiteGlobal" %>
    <%@ page import="org.apache.artimus.SiteUtil" %>
    <c:set var="threadBean" value="${requestScope.ThreadBean}" />
    <c:set var="postRows" value="${requestScope.PostBeans}" />
    <c:set var="numberOfPosts" value="${requestScope.NumberOfPosts}" />
    <c:set var="previousTopic" value="${requestScope.PreviousTopic}" />
    <c:set var="nextTopic" value="${requestScope.NextTopic}" />
    <c:set var="offset" value="${requestScope.offset}" />
    <c:set var="threadID_int" value="${requestScope.thread}" />
    <c:if test="${threadBean.threadID != threadID_int}">
        The two threadID are not the same.
    </c:if>
    <c:set var="threadID" value="${threadID_int}" />
    <%-- the code before this line works fine and I have a number of things displayed as expected --%>
    <c:forEach var="postBean" items="{postRows}" varStatus="i">
    <% PostBean postBean =
       ( PostBean )pageContext.getAttribute( "postBean" );
    %>
       <c:choose>
          <c:when test="${(postBean.parentPostID) eq 0}">
             <c:set var="background" value="#FFCE9C" />
          </c:when>
          <c:otherwise>
             <c:choose>
                <c:when test="${(i+1)%2 ne 0}">
                   <c:set var="background" value="#EEEEEE" />
                </c:when>
                <c:otherwise>
                   <c:set var="background" value="#FFFFFF" />   
                </c:otherwise>
             </c:choose>
          </c:otherwise>
       </c:choose>
    <table width="95%" border="0" cellspacing="1" cellpadding="5" align="center" bgcolor="#999999">
      <tr bgColor="${background}">
      </tr>
    </table>
    </c:forEach>

    Where is the null occuring? Have you looked at the returned HTML code to see where the 'null' is?
    You might try just a few <c:out value=""/>, like:
    The postRows = <c:out value="${postRows"/><br/>
    <c:forEach var="postBean" items="${postRows"/>
      The Current postBean = <c:out value="${postBean}"/><br/>
      The Current parentPostID = <c:out value="${postBean.parentPostID eq 0}"/><br/>
      <!-- Only do this set if background ends up null, to make sure the scope of background is wide enough -->
      <c:set var="background" value="#FFFFFF"/>
      <c:choose>
        <c:when test="${postBean.parentPostID eq 0}">
          <c:set var="background" value="#FFCE9C"/>
        </c:when>
        <c:when test="${(i+1)%2 ne 0}">
          <c:set var="background" value="#EEEEEE"/>
        </c:when>
        <c:otherwise>
          <c:set var="background" value="#FFFFFF"/>
        </c:otherwise>
      </c:choose>
      The Background is now = <c:out value="${background}"/><br/>
      <table width="95%" border="0" cellspacing="1" cellpadding="5" align="center" bgcolor="#999999">
        <tr bgColor="${background}">
        </tr>
      </table>
    </c:forEach>By adding output like that when we are debugging we can help track down where problems that occur are coming from. That and looking at the source code have been invaluable to me...

  • Accesing a List within A List Using JSTL

    Hi,
    I am trying to access a property of an object within a List Object which again is in a List object using JSTL.
    List----List----Obj1----Property1 <--( I want to print this in a Table on a JSP)
    I am unable to figure out how to do it using the <c:forEach> tag.
    Thanks in advance,
    Shardul.
    Message was edited by:
    shardul.bhatt

    Hi,
    Thanks for your response. Actually I wanted a single statement to do this. Its my mistake I should have put the question in a different manner.
    Something like
    <c:out value="${requestScope.OUTER_LIST.[FIRST_INSTANCE_OF_INNER_LIST].[OBJECT].[PROPERTY]}" ></c:out>The OuterList has many InnerLists and each InnerList has many Objects. The Property of the first Object in the InnerList is what I want to print as a 'Title' of a table.
    For example: The Objects in the Inner List are UserObjects, where all the Users of a particular type are put together in an InnerList. I want to display the users of different types grouped together and the Table should have the 'User Type' as its title.
    I could do it like this
    <tr border="2" class="selectedrow">
    <td><B><font color="#2d5c3d">User Type</font></B></td>
    <td><strong><font color="#2d5c3d">
    <!---I want to remove this with a single line of code-->
    <c:forEach items="${usersByType}"   var="user" begin="0" end="0">
          <c:out value="${user.userType}"></c:out>
    </c:forEach>
    <!---I want to remove this with a single line of code-->
    </font></strong></td>But I think there has to be a better way to do it.
    BR,
    Shardul

  • Getting a substring using JSTL

    Have string as below.
    <UL><LI>Required</LI></UL>
    Would like to get only the string "Required" with out any UL stuff.
    is it possible to get this using JSTL? if not how to get the substring "Required".
    Thanks.

    > I was trying to use for display only but <html:errors
    property="custName"/> is returning <UL> instead of a
    String.
    Do you happen to have that set up as the "errors.header" and "errors.footer" properties in your application properties file? You might consider removing the HTML markup and using JSTL to provide an unordered list when desired.
    Hope this helps.
    ~

  • When to use ProPhoto RGB color space?

    I've read articles recommending to use ProPhoto RGB color space because the color gamut is greater.  At the same time, I've had to convert some images I created using ProPhoto RGB templates to sRGB so they will display with the right colors in applications that don't support it.  I'm wondering (just curious) when it is appropriate to use this color space.  Is it only for professional graphic image designers and photographers who send their images to a professional printer?

    in addition to what ssprengel said and some of it may be in other words:
    There are several standard profiles listed in a separate section in the menus displaying color profiles when you use Assign Profile, Convert to Profile, and when you choose Working Spaces in the Color Settings. These profiles are so called 'well behaved' or 'editing' color spaces. They are device independent and created synthetically for editing purposes - in these color spaces R=G=B is perfectly neutral gray which makes the numbers of color values make sense when editing images referring to the numbers, histograms, curves, etc. ProPhoto RGB is one of these spaces and have the widest gamut, parts of which exceed the visible spectrum. This allows you to have an image with colors that are not limited to the color gamut of eventual destination color spaces like printers and monitors.  That's why some people prefer to use Prophoto RGB for images with destination unknown. When you know the destination, in your case an online printing service, get the color profile used by the printing service, install it on your computer, and use convert (Edit menu > Convert to Profile) from ProPhotoRGB to the color profile of the printer. The color management trys to make the conversion to the best possible color match when the destination color space is with a narrower color gamut and you may see color shift of the colors outside the color gamut of the destination. You can also use soft proof (View > Proof Colors with View > Proof Setup set to the destination profile) to edit (optimize) the colors of your document to the destination before the conversion if you can do better than the color management conversion. It is a good idea to make this on a copy of the original image or different layers dedicated to editing colors for a particular destination (color space).
    Also have in mind that the conversion can be done on any other computer with Photoshop provided that along with your image they have the source and destination profile. So it can be done by your printer too but without the printers profile on your computer you wont' be able to proof and edit the final appearance.
    If you create or edit your artwork or photos with destination unknown in a color space with a comparatively narrower gamut  then when in the future you have the opportunity to use a destination with a wider color space you won't be able to take advantage from all possible colors.

Maybe you are looking for

  • Peculiar exception thrown. while starting the WLS6.0

    The following error is displayed event after using the original config.xml.booted file to start the server. I did this because I was trying to convert the existing wls510 properties file & for that I was creating one more server called myserver withi

  • News paper format

    how can we do newpaper format in scripts.. how to use...

  • Calling a servlet in an ADFFaces pages

    Hi All, I have this code:     public void handleReturn(ReturnEvent returnEvent) {         // Add event code here...          if (returnEvent.getReturnValue() != null)            setLongAddressType( (Long) returnEvent.getReturnValue());            // 

  • Garbage fonts in Safari

    I've read through the previous posts on this subject, but none of the solutions seem to work in my case. In Safari, some of the webpages or parts of the webpages come up with garbage text. I've taken a screen shot of one particular site, but I'm not

  • Dynamically updating webparts

    Hello, I would like to know if it's possible to dynamically update webpart fields. For example: If the customer clicks on the "+1" button the field "value" will become = "value"+1 If the customer clicks on the "-1" button the field "value" will becom