• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

passing string array to action parameter

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application i have set string array in
String arr[]= {"1","2"}
request.setAttribute("candidate",arr);
and using this attribute now i m passing this array to action parameter in next jsp
<html:form action=/candidate.do?method=success&candidate=${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?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gajendra,

This part will not work. The browser needs the URL to look like this to interpret the parameters correctly:
/candidate.do?method=success&candidate=1&candidate=2&candidate=3

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.
reply
    Bookmark Topic Watch Topic
  • New Topic