• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp:setProperty/Bean equivalent for request.getParameterValues

 
Jacob Fenwick
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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The action uses Java reflection to match up parameters to the corresponding properties.
 
Ahmed Salah
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!