permaculture playing cards
The moose likes JSP and the fly likes passing string array to action parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "passing string array to action parameter" Watch "passing string array to action parameter" New topic

passing string array to action parameter

Gajen Pingalkar
Ranch Hand

Joined: Aug 29, 2006
Posts: 37
In my application i have set string array in
String arr[]= {"1","2"}
and using this attribute now i m passing this array to action parameter in next jsp
<html:form action=/${candidate}>

and getting these values in my action servlet by this way,
String arr[]=request.getParameterValues("candidate");

will it work? if not then how to pass array in action parameter?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33132


This part will not work. The browser needs the URL to look like this to interpret the parameters correctly:

You could write an object to create the parameter list of this form and put that in the session instead of the String[] directly.

This part will work if part I is done correctly.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: passing string array to action parameter
It's not a secret anymore!