• Post Reply Bookmark Topic Watch Topic
  • New Topic

Manipulate a Select Tag String  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably wrong forum.

I build a select tag string and use JSTL to display this string on the JSP page.

Is there an easy way to manipulate this string to remove one of the option pairs?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should not be handled after-the-fact on the JSP. Why can't you just build the string the right way in the first place?

Or, better yet, why build it as a string in the first place? Why not a more appropriate construct like a Map that can easily be used to create the select and its options via the JSTL.
 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:This should not be handled after-the-fact on the JSP. Why can't you just build the string the right way in the first place?


Need list used in two places in app. Trying to build list with all options once then in the place I need the first option to be hidden just adjust it then.

Example a list of tool boxes used as filter in a display queue tools. I need an 'All' option.

But the grid where the tool box data is maintained I don't need the all option.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the list is used in two places and each place has different requirements, then the list should be created individually for each location. This sounds as if you are trying to make things simpler by making them more complicated.

Also, you never answered the question of why you are constructing a string rather than a more appropriate data structure.
 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:If the list is used in two places and each place has different requirements, then the list should be created individually for each location. This sounds as if you are trying to make things simpler by making them more complicated.

Also, you never answered the question of why you are constructing a string rather than a more appropriate data structure.


One of the places I am using it is in a jqgrid drop down which requires it to be in html select syntax.

The list is built using sql to a remote data source. Just trying to keep from having to ping twice.

Supposed I could ping once and build the string two different ways during while loop.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Within the constraints you are placed under, I would do any manipulation at the lowest level and keep it out of the JSP is you can. JSPs are best kept as simple as possible.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!