3 Replies Latest reply on Mar 23, 2005 1:54 PM by robr

    Cannot get JSTL tags to print variable values.

    robr

      How do you set intelliJ up to use these tags.

      I completed the following.

      1. I have integrated JBOSS into intellij.
      2. I can already use servlets and JSP with in my Intellij environment.
      3. I have downloaded JSTL 1.1 and moved the two .jar files (jstl.jar and standard.jar) to the the jboss/server/default/deploy folder.
      4. I copied all eight .tld files into the web_inf folder of my IntelliJ web module.
      5. Modified my web.xml file to include all the TLD files as follows for all eight.

      <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
      <taglib-location>/WEB-INF/fmt.tld</taglib-location>

      6. Added the jstl.jar and standard.jar files to the Module Libraries in the Libraries(Classpath) tab.

      Before I did step 6 anytime I tried using jstl tags the text was set to red. After 6 the code was able to find the tag information.

      Everything compiles fine. But the tag code is being piped out like it is just a string.

      For example:
      <c-rt:forEach var="person" items="<%= names %>"> c:out value="${person}"
      </c:forEach>

      names is an array of strings. The code just prints out ${person} instead of the value it represents. The code compiles and JBOSS starts up completely clean. Any help would be appreciatted. I am using JBOSS 4.01.

        • 1. Re: Cannot get JSTL tags to print variable values.
          robr

          I don't have the code with me right now. I will post it tonight.

          • 2. Re: Cannot get JSTL tags to print variable values.
            robr

            I solved the problem or I should say a really great customer support rep at Jet Brains and another support person at http://www.fuhrer.com/en/jbossplugin/.

            The problem was that when I had set up my web module I had configured it to use version 2.3. Version 2.3 does not support JSTL tags. If you try to use them the data will be passed right through like it is a string.

            Basically I removed the web module and then readded it using version 2.4.

            My web.xml file now looks like the following.

            <?xml version="1.0" encoding="UTF-8"?>
            
            <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" >
             <servlet>
             <servlet-name>HelloServlet</servlet-name>
             <servlet-class>com.dynix.webquotes.examples.HelloServlet</servlet-class>
             </servlet>
             <servlet-mapping>
             <servlet-name>HelloServlet</servlet-name>
             <url-pattern>/greeting</url-pattern>
             </servlet-mapping>
             <ejb-ref>
             <ejb-ref-name>ejb/hello</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <home>com.dynix.webquote.HelloHome</home>
             <remote>com.dynix.webquote.Hello</remote>
             </ejb-ref>
            </web-app>
            


            My JSTLExample.jsp files looks like this.

            <%--
             Created by IntelliJ IDEA.
             User: rb
             Date: Mar 23, 2005
             Time: 10:37:55 AM
             To change this template use File | Settings | File Templates.
            --%>
            <%@ page contentType="text/html;charset=UTF-8" language="java" %>
            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
            <%!
             String[] names = {"Ruth", "Matilda", "Millicent", "Micah"};
            %>
            
            <html>
             <head><title>JSTL example</title></head>
             <body>
             <c:forEach var="person" items="<%= names %>">
             <c:out value="${person}" />
             </c:forEach>
             </body>
            </html>
            


            In the web Modules setting in the Libraries(Classpath) window I have added the following Jar/Directorys. I moved the jar and tld files from JAKARTA 1.1.2 unzipped folder before adding these jar/directory.

            D:\projects\webquotes\jstl\lib\jstl.jar
            D:\projects\webquotes\jstl\lib\jstl.jar
            D:\projects\webquotes\jstl\tld

            My project was created in the webquotes folder.

            In the Web Module Settings tab of the web Modules window I made the following change under the Modules and Libraries to Package section.

            Name Packing Method Relative
            jstl.jar Copy files to /WEB-INF/lib/jstl.jar
            standard.jar Copy files to /WEB-INF/lib/standard.jar
            d:\projects\webquotes\jstl\tld Copy dir to /META-INF/tld

            After making these changes the JSTL worked.

            I used the following.
            Intellij 4.5.4
            Jboss 4.01sp1
            Latest JBOSS plugin
            Java jdk 1.4.2_07

            • 3. Re: Cannot get JSTL tags to print variable values.
              robr

              I had read somewhere that you did not have to include the tld files in the .war file to use JSTL. I experimented some more and found this to be the case. The only thing I had to do was make sure the standard.jar and jstl.jar files were put into the WEB-INF\lib folder. It is simpler than I thought.