Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL problem

 
William Peter
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried:

instead of


But still i get the same output.
What could be the problem?
Thanks.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic