File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes enum.hasMoreElements() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "enum.hasMoreElements()" Watch "enum.hasMoreElements()" New topic
Author

enum.hasMoreElements()

Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
hi all
enum.hasMoreElements() returns false when the calling Html page has only one radio button element and user doesn't chose any value.

for eg:

for the above snippet the hasMoreElements() return false.

why and how to overcome this problem
[ September 20, 2005: Message edited by: Parameswaran Thangavel ]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Isn't request.getParameter("cardtype") the way to get the value ?


Groovy
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
I believe that is how radio buttons work. Unless you select one, the browser won't send the request parameter.
Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
hi chilkuri
can i say, we can't Come to know whether the user has selected the radio button or not by using the Request.getParameterNames();
is there any way to identify whether the user has selected or not by using the getParameterNames() in the servlet.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Parameswaran Thangavel:
hi chilkuri
can i say, we can't Come to know whether the user has selected the radio button or not by using the Request.getParameterNames();
is there any way to identify whether the user has selected or not by using the getParameterNames() in the servlet.


You could use one more hidden field indicating whether the radio button was selected or not.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: enum.hasMoreElements()