• 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

Accessing String Array with struts tags

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

What I want to do appears to be quite simple, but it is not working out that way.

I'm using Struts 1 and have a restriction to not use any JSTL or EL...only struts tags (it's a long story).

Short version:
I have an String array in the request with only one value: (stringArray = [oneValue])
And I want to display this "oneValue" on the page.

More details:
In actuality I'm passing an html:hidden value from the previous page which is coming over as a single object in a String array. I need to access this hidden value on the next page.

Thanks for your help!
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using logic iterator to iterate through the array and then bean write to print the value of the element.

Something like this should work:
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm...good idea. I actually thought that was going to work, but it didn't.

I do have a getter/setter in my form as well, just so everyone knows.

The interesting thing is that if I do this I receive the expected "oneValue":



So I know that the information is there.

Any other ideas?
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all.

Looks like the answer is found with this bean:parameter tag:



Alternatively, I could check for the variable's existence using a present tag with the parameter attribute:



I hope this helps someone else out in the future when dealing with request parameters and/or hidden form fields in struts...
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use session or request either one set the value and get where ever you want...
Like


Get wherever you want in jsp

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic