• 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

struts 2 tag accessible data in scriptlet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was wondering if there is a way to share data from a Action class to a scriptlet in my jsp. I can access what I want using struts tags <s:property value="tempBean.myVar" /> but I want to be able to get to the 'tempBean' from a scriptlet. I haven't found any real data on this from searching. The 'tempBean' object is a private field of my action class and has public getters/setters.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this in your scriptlet:



Once you get the stack you can use it to do the same look ups that you do with your struts tags.

You'll also need these 2 page directives to include the classes (plus what ever you need for your own classes):

 
Whit Fairgoose
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You sir are a stealy eyed missile man. Thank you. For some reason my version the import is a little different com.opensymphony.xwork2.ognl.OgnlValueStack, but it works!
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using an old version of struts2/xwork, I guess the moved it to a new package. Glad I could help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic