wood burning stoves 2.0*
The moose likes Struts and the fly likes how to push object onto Valuestack for OGNL access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to push object onto Valuestack for OGNL access" Watch "how to push object onto Valuestack for OGNL access" New topic
Author

how to push object onto Valuestack for OGNL access

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hey everyone,

I had quite a bit of experience developing Struts 1 app, now I am learning doing Struts 2 app and not quite clear about how to set object onto Valuestack from action level

let's say I have an Object type Employee in Action



if this was for Struts 1, than I would do



to access it in JSP (struts 1) with employee's firstname



but how do I do that with Struts 2? what syntax do I need to issue in Action class to push employee onto ValueStack?
that would have similar as




Thanks for all your replies


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The action itself is pushed onto the stack: the canonical way to expose values to the view side is to just make them action properties.

You might want to check out any of a number of web resources regarding S2 basics; this is covered on the S2 documentation wiki, many tutorials, etc.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Thanks Mr. Newton, I figure what you describe is what's actually going on. I have Sturts 2 in Action and I didn't see anything on how to push properties on to Value Stack. So that means what you said must be true and I just need to try it out in JSP

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You don't *have* to push values onto the value stack, that's what I'm saying. Struts 2 in Action covers exposing properties to the JSP all over the place; keep reading!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to push object onto Valuestack for OGNL access
 
Similar Threads
get data from valueStack inside an action
How to get object from Valuestack and pass it to another action?
Dynamic variable name in JSTL
Debugging JSPs in Struts 2 application
Code for replacing 'get' and 'set' method