This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JSTL

 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well after using scriptlets for a long time, I was using JSTL yesterday but I couldn't make it work. I was doing this



There was an object myComp in the request scope. Still the code in the if didn't got executed. Using EL worked fine



I used <c:choose> <c:when> and it worked in case of a session scoped attribute. Did I do something wrong with the <c:if>??
 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Ankit use >
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to use EL but it said that you can't use EL according to the TLD file. I'm using this tag library

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

I tried using ne instead of != but it didn't work without the EL...
 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Ankit I think you are using JSTL1.0, try using JSTL1.1, JSP2.0. And change the taglib directive to
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What led you to believe that null was valid in the EL? Check out the empty operator.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Null is legal, as are comparisons to it. Empty might be better, unless you need to specifically check for an empty container vs. a null object.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that was it. I was using the wrong version of JSTL . I was suspicious that's why I posted the taglib directive here .

Thanks Chinmaya, Bear and David ...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Null is legal, as are comparisons to it.

Oops. Brain fart.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic