public class HelloActionBean implements ActionBean {
ActionBeanContext context;
public void setContext(ActionBeanContext context) {
this.context = context;
}
public ActionBeanContext getContext() {
return this.context;
}
String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@HandlesEvent("sayHello")
public Resolution greeting() {
// return new RedirectResolution("/greeting.jsp");
return new ForwardResolution("/jsp/greeting.jsp");
}
}
利用Stripes写的一个简单Action
最新推荐文章于 2021-03-27 02:01:44 发布
本文展示了一个使用Struts2框架中的ActionBean接口的具体实现案例。该ActionBean负责处理sayHello事件,并返回一个用于页面跳转的Resolution对象。通过此示例,读者可以了解到如何设置和获取ActionBean的上下文及消息属性。
3456

被折叠的 条评论
为什么被折叠?



