2 Replies Latest reply on Nov 23, 2007 12:35 AM by dobbo

    JBossAS 4.2.2: Problem with JSTL Core

    dobbo

      Install of JBoss from jboss-4.2.2.GA.zip on Linux. Implemented a simple Stateful EJB3 so install is fine.

      Started using JSTL in a JSP file and couldn't get <c:if> to work. So I wrote the following index2.jsp simple test:

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
      <html>
       <head>
       <title>Test page</title>
       </head>
       <body>
       <c:set var="hello" value="Hello World!"/>
       <p>The variable <code>hello</code> was set to
       "<c:out value="${hello}"/>"</p>
       </body>
      </html>
      


      It generates the following output:
      The variable hello was set to "${hello}"
      


      I was expecting:
      The variable hello was set to "Hello World!"
      


      So what am I doing wrong?

      Thanks for any help.

      Steve

        • 1. Re: JBossAS 4.2.2: Problem with JSTL Core
          raist_majere

          Can you copy your web.xml file? I think it's due to not use version 2.4 or greater in it, so EL is not enabled.

          • 2. Re: JBossAS 4.2.2: Problem with JSTL Core
            dobbo

            Good call. It was an old version of web.xml. I was using 2.2:

            <!-- !DOCTYPE web-app
             PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
             "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd" -->
            

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

            and it works as expected.

            Many Thanks.
            Steve