• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

drop down list

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the best way of doing this? I have a drop down list with 4 values in the jsp. Whenever a selection is made, I need to set the value selected in the list box after processing. Here is the jsp and servlet code.





CODE] <SCRIPT language="JavaScript">
function back()
{
window.navigate("../servlet/gov.state.il.us.pe.AL_ALSPkga.pealInvalidatePeopleSession");
}

function doSort()
{
document.peopleListingForm.action="../servlet/gov.state.il.us.pe.AL_ALSPkga.pealPeopleListing";
document.peopleListingForm.submit();
}
</SCRIPT>

ltSELECT name="sortProperty" onchange="doSort()">
<OPTION value="1">SSN Ascending</OPTION>
<OPTION value="2">SSN Descending</OPTION>
<OPTION value="3">Last Name Ascending</OPTION>
<OPTION value="4">Last Name Descending</OPTION>
</SELECT>[/CODE]
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way of doing it might be to define a method on your bean that compares its parameter to the sortProperty property and returns the String "selected" if they match. You could then use it in each of the OPTION tags as follows:

I'm not sure that's the most elegant way of doing it, however.

Jules
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic