aspose file tools*
The moose likes JSP and the fly likes JSTL - test for string equals() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL - test for string equals()" Watch "JSTL - test for string equals()" New topic
Author

JSTL - test for string equals()

ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

In jstl, how do we test if an attribute in scope which is of type 'String' is equal to another String value.

Suppose I have an attribute called 'class' in scope whose value is, say, 'TR1'. In scriptlets, I would do this -



In JSTL, the best I could come up with is as below



I searched the jstl function taglib and couldn't find an equals utility. Is there an easier way to do this, rather than setting up a scoped attribute for every string you want to test against?

Thanks,
Ram.
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

I found one more way.



The above works.
Though this looks neater, I got this by trial and error.
I dint find any documentation on such usage.

ram.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61753
    
  67

Originally posted by ramprasad madathil:
I dint find any documentation on such usage.


Do you not have a copy of the JSP Specification?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489


Do you not have a copy of the JSP Specification?


Sorry, apparently I searched in the wrong place.
I did look through the jstl spec and couldnt find anything.
I thought such stuff would find place in the jsl spec rather than the jsp spec.

ram.
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Got it.
I should have searched under 'Expression Language' (JSP.2.3 General Syntax of the Expression Language) in the jsp spec.

Thanks,
Ram.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL - test for string equals()