Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: v2.1
    • Fix Version/s: V3
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: PC

    • Issuezilla Id:
      11,349

      Description

      I have a JSP with
      tag lib import <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/c" %>

      and <c:out value="$

      {webappTitle}"/>.

      When I deploy it to Glassfish server 2.1, and compile at runtime, it generates
      the following code.

      _jspx_th_c_out_0.setValue((java.lang.Object)
      org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${webappTitle}

      ",
      java.lang.Object.class, (PageContext)_jspx_page_context, null));

      But, when I pre-compiled it using sun-appserv-jspc, it generates the following
      code, where evaluateExpression is missing.

      _jspx_th_c_out_0.setValue(new String("$

      {webappTitle}"));

      So, when I pre-compile it and deploy, the expression is not evaluated and I see
      ${webappTitle}

      on the browser.

        Activity

        Hide
        averagegeeker added a comment -

        I downloaded jstl 1.2 and its implementation, removed c.tld, changed the uri
        and still I get the same code generated. I will attach all the changed stuff
        again. Thanks for taking time to resolve this issue.

        Show
        averagegeeker added a comment - I downloaded jstl 1.2 and its implementation, removed c.tld, changed the uri and still I get the same code generated. I will attach all the changed stuff again. Thanks for taking time to resolve this issue.
        Hide
        averagegeeker added a comment -

        Created an attachment (id=4140)
        Changed code that generates same old code.

        Show
        averagegeeker added a comment - Created an attachment (id=4140) Changed code that generates same old code.
        Hide
        kchung added a comment -

        Turns out that the problem is with web.xml. It is not a valid web.xml in that
        it does not contain a webapp version and the default for jasper is 2.3, I think.
        With web version 2.3 and before, EL expressions are not processed in JSP. In
        the case when the JSP compilation is triggered by the web container, the web.xml
        is processed by the web container, which may default the web version to 2.5 (in
        v2.1).

        To fix this problem, in web.xml, use

        <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd">

        Show
        kchung added a comment - Turns out that the problem is with web.xml. It is not a valid web.xml in that it does not contain a webapp version and the default for jasper is 2.3, I think. With web version 2.3 and before, EL expressions are not processed in JSP. In the case when the JSP compilation is triggered by the web container, the web.xml is processed by the web container, which may default the web version to 2.5 (in v2.1). To fix this problem, in web.xml, use <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd ">
        Hide
        averagegeeker added a comment -

        Are you sure about the URL http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd ?
        This give me 404 when I try it through the browser. If I try
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd it works fine.

        Show
        averagegeeker added a comment - Are you sure about the URL http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd ? This give me 404 when I try it through the browser. If I try http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd it works fine.
        Hide
        kchung added a comment -
        Show
        kchung added a comment - You are right. Use Either 2.4 ( http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ) or 2.5 ( http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd )

          People

          • Assignee:
            kchung
            Reporter:
            averagegeeker
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: