• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

jsp:setProperty/Bean equivalent for request.getParameterValues

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I want to pass multiple parameters with the same name and store those parameters in a bean as a string array, using jsp:useBean and jsp:setProperty where property="*".
What does the setter block inside the bean look like? Is the input parameter a string array, and jsp:setProperty is smart enough to see all the request parameters with the same name so it knows to put them all in the array?
I tried building something with that image in mind, and it didn't work. I tried passing multiple values through the URL such as ?var=test&var=test2 and it didn't store any of them. I've been searching through books but I guess people don't do this very often.

I'd appreciate any help provided.
Jacob
 
Sheriff
Posts: 67266
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The action uses Java reflection to match up parameters to the corresponding properties.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish that helps
html file:


Bean Class


JSP file:
 
Jacob Fenwick
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ahmed I will try that.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!