1 Reply Latest reply on Mar 14, 2008 10:34 PM by sepgs2004

    Guys, EL expression/JSTL tags just display literally on my p

    sepgs2004

      I have JBoss 4.2.2, downloaded this Apache Taglibs standard.jar and jstl.jar and put these jars in jboss/server/default/lib directory; got past the compilation errors. Now on my rendered HTML page, EL expression just gets printed as it is in JSP, it does not get evaluated, seems like JBoss JSP compiler just does not apply tag library.
      However my java scriptlet prints the values correctly. Can you guys help me. Thanks for your time.

      Following is my JSP code

      <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
      <%@ page import="java.util.ArrayList" %>
      <%@ page import="com.model.Friends" %>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
      <html>
      <head>
      ...
      <%
      ArrayList friendsList = (ArrayList) request.getAttribute("friendsList");
      if (friendsList != null) {
       int i = 0;
       for (i=0; i<friendsList.size(); i++)
       {
       Friends f = (Friends) friendsList.get(i);
      %>
       <%=f.getFirstName()%>
      <%
       }
      }
      else {
      %>
      <%=new String("List is null")%>
      <%
      }
      
      %>
      <br/>
      <c:forEach items="${requestScope.friendsList}" var="friend">
       First name : <c:out value="${friend.firstName}" />
       Last name : <c:out value="${friend.lastName}" />
       Comments : <c:out value="${friend.comments}" />
      </c:forEach>
      ...
      


        • 1. Re: Guys, EL expression/JSTL tags just display literally on
          sepgs2004

          My web.xml, <web-app> element didnt have any mention of the namespace. May be the container assumed its favorite I think.

          I found information from this link:
          http://forum.java.sun.com/thread.jspa?threadID=552164&messageID=2701247

          I updated my web.xml to reflect the following:

          <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 web-app_2_4.xsd" version="2.4">
          


          Then things started working. I mean the EL gets evaluating. I think the container goes by this namespace declaration to determine its compilation/translation/execution process. I do not know exactly what/how it works based on the namespace declarations.

          I had to clear the cache of JBoss App server though (jboss/server/default/work/... and jboss/server/default/tmp/...). Until then I was not able to see the change. Pretty misleading because of the App server Cache.
          I think any changes to JSP or XML files, it is better to stop the server, clear the App server cache, redeploy the application and restart the server to see the results of whatever we modified in the application.

          Thanks Guys.