Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Re: servlets digest: March 11, 2003 Creating lists of input using Radio / Checkb


Message #1 by "Paul Byford" <p_byford@h...> on Wed, 12 Mar 2003 11:42:55 +0000
Thanks so much for your response, Paul! I think the first option will be 
more suitable for my data. 
 
Ashima

I would say you have two options.

1. Use check boxes (and some javascript). If you use check boxes you can 
then use a javascript function to make the checkboxes behave like 
radiobuttons.
For example have a javascript method called;
emptyOtherCheckBoxes(var checkBoxGroup, var checkBoxSelected){
// method code here
// code uses varibles to empty the other two boxes
}

Then when a box is selected call the method.

2. Use radiobuttons. (Best option)
Then in servlet call the method getParameterNames() on the request 
object. 
This will return all the parameter names from the form which you can then 
manipulate to get a value from. you can then use this data and the method 
request.getParameter("paramName") to get the data.

check http://www.dataoncall.com/snippets/java/getParameterNames().jsp for 
an 
example of how to do this.



This will return an enumeration of  string array of the values selected 
which you can then access.

i.e.

String[] namesSelected



  Return to Index