Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting request attribute in jsp set from Action Class

 
Gopikrishna Gopal
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic