>If the radio wasn't checked at all the first line of output will be
>null, but if I test against that I get a NullPointerException. If I
>use:
You shouldn't get a null pointer exception if you are testing properly:
The way you would normally test to see if its null (hasn't been checked)is:
String temp = req.getParameter("radio1");
if(temp == null)
{
//do something
}
>out.println(req.getParameterValues("radio1"));
>I get something like:
>[Ljava.lang.String;@7310a09a
This is because getParameters always returns a string[]. Even an empty array,
but it won't return you a null. You can check this one like this:
String[] s = req.getParameterValues("radio1");
if (s.length == 0)
//do something
>I don't need the memory address, I need the string in the memory
>address.
Hahaha, this is Java my friend, no need to worry about memory addresses.
>Thanks for ANY help given.
Ok, here is the proper way to validate radio/check buttons. In your html,
give each radio button the same name (ie: not radio1, 2, 3, but just radio for
all of them).
In your servlet you do a req.getParameterValues, and then iterate through
the returned array to get the data you want.
Hope this helps.
Floyd
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html