2 Replies Latest reply on Oct 26, 2006 3:22 PM by tthach

    JSTL on JBoss 4.0.2

    tthach

      Hi,
      I'm trying to deploy the simple hello1 web project from the J2EE 1.4 tutorial on JBoss 4.0.2. Although it deploys fine and I can access the page, the behavior is not correct. When I enter some text and hit submit, then the text "Hello <some text>" should also be displayed on the page. However, this does not happen, which leaves me to believe that the JSTL tags are not being evaluated.

      This is the index.jsp:

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
      <html>
      <head><title>Hello</title></head>
      <body bgcolor="white">
      <img src="duke.waving.gif">
      <h2>Hello, my name is Duke. What's yours?</h2>
      <form method="get">
      <input type="text" name="username" size="25">
      <p></p>
      <input type="submit" value="Submit">
      <input type="reset" value="Reset">
      </form>
      
      <c:if test="${fn:length(param.username) > 0}" >
       <h2><font color="black">Hello, ${param.username}!</font></h2>
      </c:if>
      </body>
      </html>
      


      This is the web.xml in use:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app
       PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
       "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
       <display-name>hello1</display-name>
       <taglib>
       <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
       <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
       </taglib>
       <taglib>
       <taglib-uri>http://java.sun.com/jsp/jstl/functions</taglib-uri>
       <taglib-location>/WEB-INF/tld/fn.tld</taglib-location>
       </taglib>
      </web-app>
      


      I've packaged everything in a war with the web.xml file under WEB-INF, the tld files under WEB-INF/tld and the jstl.jar and standard.jar under WEB-INF/lib.

      Any ideas on what's going on?
      Thanks,
      Tai


        • 1. Re: JSTL on JBoss 4.0.2
          peterj

          Make the following changes to your web.xml file:

          1) remove the DOCTYPE

          2) change webapp to read:

          <web-app
           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"
           version="2.4">



          • 2. Re: JSTL on JBoss 4.0.2
            tthach

            Thanks! That worked. I don't know why I changed it in the first place....