Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to install JSTL on w2k?

Status
Not open for further replies.

cyan01

Programmer
Mar 13, 2002
143
US
Hi, Experts,

I am new to JSP and am study a book "Beginning jsp 2.0". But I am having trouble in running the examples in this book.

Here is the details:

1) The example that I am running:

Code:
<%@ taglib uri="[URL unfurl="true"]http://java.sun.com/jstl/core_rt"[/URL] prefix="c" %>
<html>
    <body>
        You sent the following request headers:
        <p/>
        <table border="1">
            <tr>
                <th>
                    Header
                </th>
                <th>
                    Value
                </th>
            </tr>
        <c:forEach var="entry" items="${header}">
            <tr>
                <td>
                    ${entry.key}
                </td>
                <td>
                    ${entry.value}
                    
                </td>
            </tr>
        </c:forEach>
        </table>
    </body>
</html>

2) The error message I got:

org.apache.jasper.JasperException: The absolute uri: cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:147)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

3) My guess is that I did not set up my jstl correctly. I got my jstl at here:


The file name is jakarta-taglibs-standard-1.1.2.zip.

After unzip it, I noticed that there are two jar files in lib dir: jstl.jar and standard.jar. The path for the example listed above is:

%CATALINA_HOME%\webapps\RequestHeaders\request.jsp
%CATALINA_HOME%\webapps\RequestHeaders\WEB-INF\lib\jstl.jar
%CATALINA_HOME%\webapps\RequestHeaders\WEB-INF\lib\standard.jar

Based on my best understanding, that's all I need to do in order to setup jstl. Have I missed something? Or am I totally wrong?

Thank you very much for reading and help!
 
Put both in the WEB-INF/lib directory of your web application.
That should be enough to get any JSP under the webapp to use JSTL.

Of course you do need to use Tomcat 5.0 or later to have JSTL 1.1 support at all.
If you're using Tomcat 4.x, replace that with the latest stable 5.x build (5.5.something).
 
Thank you very much, jwenting, I have fixed this problem couple weeks ago.
 
It's a good practice to tell people when you fix your problem ...
 
The reason I did not post my solution here was that I thought few people cares at this forum. I posted my question here on 2-11-2005, and I resolved the problem around 2-20. I even forgot I posted a question here.

The solution may not make too much sense, either. But here you go:

1) I reinstalled JRE, TOMCAT & JSTL;
2) And the file structure is like this:
%CATALINA_HOME%\webapps\myjsp\{all jsp files}
%CATALINA_HOME%\webapps\myjsp\WEB-INF\lib\{jstl jar files}

That's it. I can not explain why it did not work first time.
 
well, that is the standard (in fact the only correct) solution :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top