File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to push object onto Valuestack for OGNL access

 
Davie Lin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic