• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

jsp and forms

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I retrieve information from a form in jsp. I'm using a <select> drop box. When the user selects something from it, I want the page to recognize what was selected immediately and reload the page. Also, how do I get the page to reload immediately? I guess you could say that the page is dynamic. TIA.
Kevin
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To retrieve form parameter in a JSP page use request.getParameter("param") where param is the name of the parameter.
To automatically submit a page when a item is selected in a drop-down use the onChange event of DHTML. Then use javascript to submit the form.
Example:
<form name="testForm" action="action.jsp">
<select name="testSelect" onChange="javascript:document.forms['testForm'].submit();">
<option value="1">One</option>
<option value="2">Two</option>
</select>
</form>
I didn't test it so if it doesn't work exactly... oh well.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, anyone tested? Does it work? =D
 
kevin schmidt
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I managed to get something to work, still have a little bit of a problem though.
 
Do not threaten THIS beaver! Not even with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic