• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTML and Servlets ,elemnts with same name.  RSS feed

 
Arvind Chavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am haing same name for five of th eelements in a HTML form.How do I retrieve these values in a servlet on the server.
Thanks
Arvind
 
sanjay yermalkar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can use in HttpServletRequest.
 
Rohit Ahuja
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry get parameter values works only if the textfields names are different. for same names u cant help it,only God can help.
 
Dharmesh Chheda
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of a form is it which has fields having the same name?... ..

[This message has been edited by Dharmesh Chheda (edited November 30, 2001).]
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getParametervalues() is what you need, as already posted. It is used to retrieve a form element which can have multiple values.
String[] yourValues = request.getParameterValues("yourFormElementName")


------------------
Bosun
SCJP for the Java� 2 Platform
 
Arvind Chavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, getParameterValues() works very well.
Arvind
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!