Problems with recognizing JSTL

I would like to use JSTL in my project.
Because my servlet-container supports servlets 2.3 and jsp 1.2 - I chose
JSTL 1.0.5.
I downloaded reference implementation from Jakarta and installed in my
webapp.

I copied jstl.jar and standard.jsr into my WEB-INF/lib directory
Then I copied:

c-rt.tld
c.tld
fmt-rt.tld
fmt.tld
sql-rt.tld
sql.tld
x-rt.tld
x.tld

into my WEB-INF directory.
Following standard-examples.war - I didn't insert any taglibs declarations
into my web.xml file.

When I reference core jstl library in my jsp file:

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

I get it marked as red.

So I have a question?
What else should I do to enable JSTL for Idea 4.0?

1. Do I have to add standard.jar and jstl.jar to classpath?
2. Do I have to reference taglibs explicitly in WEB-INF?

I thought it should work without explicitly referencing JSTL taglibs... it
works that way in my servlet container (tomcat 4.1.24).

Where's the problem?










3 comments
Comment actions Permalink

First, I'm going to assume you've created a Web module. Then, for
third-party libraries like JSTL I like to make them Global libraries so I
can use them in future projects. After you do that (or just put the jars in
your project), you still need to add entries in your web.xml to point to the
correct tlds. Then you can reference the uri from your web.xml in your jsp.
Hope that helps.

"Micha³ Szklanowski" <michal.szklanowski@nospam.empolis.pl> wrote in message
news:c0t56h$uap$1@is.intellij.net...

I would like to use JSTL in my project.
Because my servlet-container supports servlets 2.3 and jsp 1.2 - I chose
JSTL 1.0.5.
I downloaded reference implementation from Jakarta and installed in my
webapp.

>

I copied jstl.jar and standard.jsr into my WEB-INF/lib directory
Then I copied:

>

c-rt.tld
c.tld
fmt-rt.tld
fmt.tld
sql-rt.tld
sql.tld
x-rt.tld
x.tld

>

into my WEB-INF directory.
Following standard-examples.war - I didn't insert any taglibs declarations
into my web.xml file.

>

When I reference core jstl library in my jsp file:

>

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

>

I get it marked as red.

>

So I have a question?
What else should I do to enable JSTL for Idea 4.0?

>

1. Do I have to add standard.jar and jstl.jar to classpath?
2. Do I have to reference taglibs explicitly in WEB-INF?

>

I thought it should work without explicitly referencing JSTL taglibs... it
works that way in my servlet container (tomcat 4.1.24).

>

Where's the problem?

>
>
>
>
>
>
>
>
>
>


0
Comment actions Permalink


U¿ytkownik "Brad Lane" <lanebr@ncs.com> napisa³ w wiadomo¶ci
news:c0tahf$5k2$1@is.intellij.net...

First, I'm going to assume you've created a Web module. Then, for
third-party libraries like JSTL I like to make them Global libraries so I
can use them in future projects. After you do that (or just put the jars

in

your project), you still need to add entries in your web.xml to point to

the

correct tlds. Then you can reference the uri from your web.xml in your

jsp.

Hope that helps.


Thanks Brad. In fact, I've solved the problem after some thinking.
The missing part of the picture was standard.jar - missing in my Idea
classpath.

I don't have to add entries for JSTL taglibs in my web.xml file. To archieve
this
you must have a look at standard.jar internal structure.
In this jar, in META-INF directory, there exist all tld's - JSTL need to
function properly:

c-rt.tld
c.tld
fmt-rt.tld
fmt.tld
sql-rt.tld
sql.tld
x-rt.tld
x.tld

So, if you are making your own tag library and pack tlds along with classes
into jar - you
don't need to reference them in web.xml.

The trick is how tag library is described in tld file:

1.0 1.2 c http://java.sun.com/jstl/core The uri element tells that if you reference http://java.sun.com/jstl/core in your JSP - this point right to this tag library. So now I can make pages like this: ]]>JSTL: Source code for <c:out value="$"/></title> </head> <body bgcolor="#FFFFFF"> <h3>Source code for:  <c:out value="$"/></h3>
</body>
</html>


I hope this help for future JSTL users.
Once again, thanks for marvellous tool, Jetbrainers.



0
Comment actions Permalink

Well I'll be... thanks. Learn something new every day.

"Micha³ Szklanowski" <szklanowski@nospam.aster.pl> wrote in message
news:c0tuc0$ekg$1@is.intellij.net...
>

U¿ytkownik "Brad Lane" <lanebr@ncs.com> napisa³ w wiadomo¶ci
news:c0tahf$5k2$1@is.intellij.net...

First, I'm going to assume you've created a Web module. Then, for
third-party libraries like JSTL I like to make them Global libraries so

I

can use them in future projects. After you do that (or just put the jars

in

your project), you still need to add entries in your web.xml to point to

the

correct tlds. Then you can reference the uri from your web.xml in your

jsp.

Hope that helps.

>

Thanks Brad. In fact, I've solved the problem after some thinking.
The missing part of the picture was standard.jar - missing in my Idea
classpath.

>

I don't have to add entries for JSTL taglibs in my web.xml file. To

archieve

this
you must have a look at standard.jar internal structure.
In this jar, in META-INF directory, there exist all tld's - JSTL need to
function properly:

>

c-rt.tld
c.tld
fmt-rt.tld
fmt.tld
sql-rt.tld
sql.tld
x-rt.tld
x.tld

>

So, if you are making your own tag library and pack tlds along with

classes

into jar - you
don't need to reference them in web.xml.

>

The trick is how tag library is described in tld file:

>

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jstl/core</uri>

>

The uri element tells that if you reference http://java.sun.com/jstl/core

in

your JSP - this point right
to this tag library.

>

So now I can make pages like this:

>
>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<% pageContext.setAttribute("filename", request.getParameter("filename"));
%>
<html>
<head>
<title>JSTL: Source code for <c:out value="$"/></title> > </head> > <body bgcolor="#FFFFFF"> > <h3>Source code for:  <c:out value="$"/></h3>
</body>
</html>

>
>

I hope this help for future JSTL users.
Once again, thanks for marvellous tool, Jetbrainers.

>
>
>


0

Please sign in to leave a comment.