File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts 2 question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 2 question" Watch "struts 2 question" New topic
Author

struts 2 question

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
It shows that struts 2 put object(s) in its value stack. I am wondering what are put into the "object" part of value stack ? For example, if I have an action like

public class HelloStruts {

public static final String MESSAGE = "Struts is up and running ...";

public String execute() throws Exception {
setMessage(MESSAGE);
return "success";
}

private String message;

public void setMessage(String message){
this.message = message;
}

public String getMessage() {
return message;
}
}

Is the "HelloStruts" obj put in the value stack' object list ? Do I have to explicitly do something to add it to value stack ? If I have several pages, from 1st Action to 2nd Action, to 3rd Action, etc, are all of them automatically all saved in the value stack's object list ? or only the last Action is saved in the value stack's object list ?
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 689


hi,

yes, only last action value you can get and all action variable are store at OGNL value stack.

and you don't need to do explicitly. If you want to your action class variable to after three or four iteration of your action then you have to put it to your session.

for more information see Struts2 + OGNL value stack.

http://struts.apache.org/2.0.14/docs/ognl-basics.html




Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts 2 question