Click to See Complete Forum and Search --> : Check boxes


GangWU
07-17-2003, 04:32 PM
Is there anyone who is using webmacro?

I have a group of checkboxes in one html page. After check some of them it goes to next page while it calls java servlet function. I can use getParameter("checkbox name") to retrieve the boxes but I don't know how I can tell which box was checked.

Any help is appreciated.

GangWU
07-17-2003, 04:33 PM
Is there anyone who is using webmacro?

I have a group of checkboxes in one html page. After check some of them it goes to next page while it calls java servlet function. I can use getParameter("checkbox name") to retrieve the boxes but I don't know how I can tell which box was checked.

Any help is appreciated.

Khalid Ali
07-17-2003, 06:33 PM
you can use request.getPrameterNames()

to get an enumeration of all the form element names,loop through the enumeration ,get the name and thenget the value of html form element by its name....

java.util.Enumeration enums = request.getParameterNames();
while(enums.hasMoreElements()){
String paramName = String.valueOf(enums.nextElement());
System.out.println("Parameter Name = "+paramName+", value = "+request.getParameter(paramName));
}

Hope this helps