This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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
bean error
i do not understand servlet request.setAttribute ~
Problem: Cannot find bean "messageBean" in any scope
bean problem
Multiple Files in an InputStream