• Post Reply Bookmark Topic Watch Topic
  • New Topic

Comparing a String in JSTL When Tag

 
Steve Dyke
Ranch Hand
Posts: 1716
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JSTL to populate a Select list. I am using conditional tags to know which item is pre selected based on a session default for the user. As I loop through an array to populate list I need to compare the first three characters to my default value. How can I use substring or index of within the JSTL tags?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean using a Substring of a given String ?

In this case the fn taglib will help



returns 'java'
 
Steve Dyke
Ranch Hand
Posts: 1716
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:You mean using a Substring of a given String ?

In this case the fn taglib will help



returns 'java'


Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you not have a JSTL Specification open on your desk?
 
Steve Dyke
Ranch Hand
Posts: 1716
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Do you not have a JSTL Specification open on your desk?


Well, it's not exactly open, but it is on my desktop.

I will try and do better. And learning more everyday.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest reading the entire thing, cover to cover (it's not that big), so you know what tools you have available at your fingertips.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True, it's basically quite easy to catch a general glimpse of what the different JSTL taglibs have to offer ...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!