This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes JSTL problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL problem" Watch "JSTL problem" New topic
Author

JSTL problem

William Peter
Greenhorn

Joined: Jan 09, 2009
Posts: 5
Hi all,
I am new to jstl but a bit familiar with scriptlets. I was trying the program given at http://www.developer.com/java/ejb/article.php/1447551.
The Code is

The text field shows up and when i enter anything in the text field i do not get the required output(the if condition is not executing).
However the following code produces the correct output.

I use tomcat ver 6.0.18 , jstl-1.2 , java 6.
Can somebody please help me understand why the former executes incorrectly but not the latter?
Thanks.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
To start off, the taglib URI is wrong.

Read the TLDDOC for the right URI: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs
William Peter
Greenhorn

Joined: Jan 09, 2009
Posts: 5
I tried:

instead of


But still i get the same output.
What could be the problem?
Thanks.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Well, then the problem lies somewhere else. The given code looks fine. I can't spot any faults in the given information as far.
Try c:out instead of c:if and see what it says.

That said, I know that you're just learning/playing/testing, but actually this kind of logic belongs in a Servlet. Keep that in mind.
William Peter
Greenhorn

Joined: Jan 09, 2009
Posts: 5
Well, then the problem lies somewhere else. The given code looks fine. I can't spot any faults in the given information as far.
Try cut instead of c:if and see what it says.

I tested it like this:

While i got "Debug" printed as the output, "Debug1" is not printed.

could you please look if anything is wrong with the web.xml file?
I have this.



That said, I know that you're just learning/playing/testing, but actually this kind of logic belongs in a Servlet. Keep that in mind.

Thanks for the tip.I'll keep that in mind.
Thanks again.

Edit:
I am using servlet-1.2.jar file instead of standard.jar and jstl.jar if that helps.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
William Peter wrote:
I tested it like this:

While i got "Debug" printed as the output, "Debug1" is not printed.

I didn't mean that. I rather mean something like:


could you please look if anything is wrong with the web.xml file?
I have this.

(...)

You should not extract the JSTL JAR file. You should not messup your classpath with duplicated TLD of the JAR. You should not messup your web.xml with duplicated TLD entries.

Remove them all. Clean up your classpath and web.xml from all that mess. Just place jstl.jar (and in case of JSTL 1.1 or older also the standard.jar) in the classpath (which by default covers /WEB-INF/lib) and declare the taglib in the JSP page. Nothing more is needed.
William Peter
Greenhorn

Joined: Jan 09, 2009
Posts: 5
Yay!Thanks Bauke Scholtz.
It is working now.


You should not extract the JSTL JAR file. You should not messup your classpath with duplicated TLD of the JAR. You should not messup your web.xml with duplicated TLD entries.

Remove them all. Clean up your classpath and web.xml from all that mess. Just place jstl.jar (and in case of JSTL 1.1 or older also the standard.jar) in the classpath (which by default covers /WEB-INF/lib) and declare the taglib in the JSP page. Nothing more is needed.

I got that (wrong) step from this site:
http://www.roseindia.net/jstl/downloading-jstl.shtml
I guess it's old tutorial or something.
Can you recommend some good new tutorial for JSTL and EL?
I learned scriptlets from www.jsptut.com
Thanks a lot for your help and time.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Oh no, not roseindia.net again. I am almost going to cry instead of laugh now.
Read this: http://balusc.blogspot.com/2008/06/what-is-it-with-roseindia.html

Use Sun's own Java EE tutorial. It covers JSTL and EL as well.
William Peter
Greenhorn

Joined: Jan 09, 2009
Posts: 5

Oh no, not roseindia.net again. I am almost going to cry instead of laugh now.
Read this: http://balusc.blogspot.com/2008/06/what-is-it-with-roseindia.html

I didn't know that.
Nice blog you have got there.

Use Sun's own Java EE tutorial. It covers JSTL and EL as well.

I will follow http://java.sun.com/javaee/5/docs/tutorial/doc/bnake.htm instead from here onwards.


Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL problem
 
Similar Threads
que in spring mvc - simpleformcontroller
login page
c:if test doesnt like el?
JSTL problem
Can a EL expression pass a value that was entered into a form?