Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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
 
Shiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic