3 Replies Latest reply on Mar 29, 2007 11:24 AM by kreilly

    Trouble using JSTL

    kreilly

      I'm having trouble getting JSTL to work in a portlet. Here's my JSP:

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

      View Mode <c:out value="${name}" />

      And here's the output:

      View Mode $name

      The tag is not recognizing the runtime expression. I've checked and name is a string bound to the request (<%= request.getAttribute("name") %> will print the name), and the jstl libraries are in my WEB-INF/lib directory. I know the taglib directive is being understood because I was getting an error message unil I put the libraries into my lib directory.

      Any help would be appreciated.

        • 1. Re: Trouble using JSTL
          wangjianme

          Hello ! try to use <%@ prefix="c" uri="http://java.sun.com/core_rt"%>

          • 2. Re: Trouble using JSTL
            antoine_h

            I use :

            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

            in the login.jsp page, in the portal-server.war
            (see \deploy\jboss-portal.sar\portal-server.war)

            added the library in the WEB-INF/lib folder
            (\deploy\jboss-portal.sar\portal-server.war\WEB-INF\lib)

            in war for portlet, should work the same.

            if the tag is not recognized at runtime, may be get the tld file, and add it in the WEB-INF.
            for diagnostic purpose... see what happen...

            I look at the way it is done with taglib of portal in layout jsp pages, or admin portal jsp pages... and make the same for the jstl lib

            hope it helps...





            • 3. Re: Trouble using JSTL
              kreilly

              Hi All,

              thanks for the help. It turned out that I needed to add the following line to the top of my JSP:

              <%@ page contentType="text/html" isELIgnored="false"%>

              This tells the JSTL tags to evaluate the runtime expression, or else they assume the rentime will be evaluated before it is passed to the tag.

              Thanks again for all the help.