The moose likes Struts and the fly likes Getting request attribute in jsp set from Action Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting request attribute in jsp set from Action Class" Watch "Getting request attribute in jsp set from Action Class" New topic
Author

Getting request attribute in jsp set from Action Class

Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
Isnt it possible to store request attribute as follows in Action Class and access it in JSP ?
I know there is a simple way of directly doing getter and setter methods in Action Class. But just want to know if its possible to get values from request attributes in jsp using struts tags.

public class SignupAction1 extends ActionSupport {

HttpServletRequest request = ServletActionContext.getRequest();
MessageBean messageBean = new MessageBean();
messageBean.setMessage("test");
request.setAttribute("messageBean", messageBean);
@Override
public String execute() throws Exception {
...
return SUCCESS;
}
}

In jsp, use s:property tag to get the value ? If so, please mention how to do it.
 
Don't get me started about those stupid light bulbs.
 
subject: Getting request attribute in jsp set from Action Class