aspose file tools*
The moose likes JSP and the fly likes Problem with JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with JSTL" Watch "Problem with JSTL" New topic
Author

Problem with JSTL

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi, Ankit use >
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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

Joined: Apr 21, 2008
Posts: 432
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

Joined: Jan 10, 2002
Posts: 61063
    
  66

What led you to believe that null was valid in the EL? Check out the empty operator.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Aug 03, 2008
Posts: 9293
    
  17

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

Joined: Jan 10, 2002
Posts: 61063
    
  66

David Newton wrote:Null is legal, as are comparisons to it.

Oops. Brain fart.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JSTL