aspose file tools*
The moose likes JSP and the fly likes JSTL not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL not working" Watch "JSTL not working" New topic
Author

JSTL not working

sunny van
Greenhorn

Joined: Jan 16, 2005
Posts: 5
I have copied standard.jar & jstl.jar in lib folder.
i have created HTML file & JSP file.

-----------------jstl.html--------------------

<html>
<body>
<form method=Get action="jstl.jsp" >
<input type="input" name=text1 />
<input type="submit" value="Submit" />
</form>
</body>
</html>
-----------------------------------------------

------------------jstl.jsp-------------------

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<body>
<c:set var="s" value="${param.text1}" />
we welcome <br>
<c ut value="${s}" />

</body>
</html>

--------------------------------------------------------

when i have run this the output is only "we wellcome"
what is going wrong in my code.
Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
Hi Sunny, first off what container are you using. I found out the hard way JRun4 doesn't support jstl, at least easily anyways. Make sure your web.xml's web-app element has 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">

</web-app>


SCJP 1.4 SCJD 1.5
sunny van
Greenhorn

Joined: Jan 16, 2005
Posts: 5
Hi, I am using tomcat & here is the following web.xml file i have.

<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">

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>

is it rigth? if rigth where i am wrong?
Sree Nivas
Ranch Hand

Joined: Jul 24, 2003
Posts: 95
Hi,

Same problem for me also. I'm trying to execute a JSTL program of HF Servlets and JSP book (Page: 437). This is <c:forEach> JSTL. As mentioned in the book, I have copied standard.jar and jstl.jar to my app WEB-INF/lib folder and I'm using jakarta-tomcat-5.0.12 and web.xml contains <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">
also. I'm getting the following error.
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:363)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:190)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:525)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1625)
org.apache.jasper.compiler.Parser.parse(Parser.java:173)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

What could be the wrong here. I also set classpath to these two jar file in setclasspath.bat file and at dos prompt, but no use.

I'm now preparing for SCWCD and structed here. Request somebody to clarify this.

regards
Sreenivas
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
did you place the TLD for your JSTL implementation in the correct location (meaning next to web.xml).

And do NOT put a reference to JSTL in your web.xml


42
Sree Nivas
Ranch Hand

Joined: Jul 24, 2003
Posts: 95
Actually, one shouldn't have to do that.

The tld files are present in the standard.jar file and should be automatically picked up by Tomcat if the jar is in the classpath.

AND I think I have not correctly picked up the jar files for JSTL 1.1. I opened these jar file and found the uri is: http://java.sun.com/jstl/core which is 1.0 jstl.

BTW where can I download JSTL1.1 jar files?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you're right. Was confused with our own custom taglib

The Jakarta JSTL implementation is on their website. You indeed have to be careful which you get, but the version number is part of the filename of the archive.
sunny van
Greenhorn

Joined: Jan 16, 2005
Posts: 5
hi my problem is getting bigger,the following error is showing after running my application.i do not no where i went wrong.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /jstl.jsp(4,12) quote symbol expected
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90)
org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:198)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1328)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1560)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
jyothi sanka
Ranch Hand

Joined: Aug 27, 2001
Posts: 39
hi,if you write taglib dirctive like this
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
for Tomcat 5. It works fine. but I don't know the difference with _rt or without _rt.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

The 'rt' library is part of the JSTL 1.0 which should not be used with Tomcat 5. You should be using the JSTL 1.1 instead.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL not working