• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

In List Highlighting previous selected values

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
In my application, I have one list box, as per the code.

<select Name="Entity" multiple="true" size="">
<logic:iterate id="Price" name="Price" property="basePriceTypePresList">
<logic:iterate id="ent" name="Price" property="ent">
<option value="<bean:write name="ent" property="key"/>">
<bean:write name="ent" property="value"/>
</logic:iterate>
</logic:iterate>
</select>

If i select one option from list box , for time being it display as selected and when i submit this page and again come to this page. That time, i want to show selected item of list how to do this(i.e. highlighting previously selected values), pls suggest

-Gajendra
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure we understand your requirement. You want to submit this page and then reload the same page with the selected values ?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, "pls" is not a word in the English language.
See:
http://faq.javaranch.com/view?UseRealWords
to find out why using real words is important to us.

Adding the "selected" attribute to your option tag will cause it to be drawn on the page as selected.

The logic:iterate tag is a Struts tag isn't it?
If so, I believe there is a Struts specific way to build select lists.
Moving to our Struts forum where someone will be able to explain how to use those tags better than we could.
[ April 24, 2007: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use either <html:options> or <html:optionsCollection> along with <html:select>, Struts will automatically show the correct item as selected when the page is redisplayed.
[ April 24, 2007: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic