This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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.
 
wood burning stoves
 
subject: Getting request attribute in jsp set from Action Class
 
Similar Threads
i do not understand servlet request.setAttribute ~
bean problem
Multiple Files in an InputStream
Problem: Cannot find bean "messageBean" in any scope
bean error