Struts2 Convention插件的使用(2)return视图以及jsp的关系

 1 package com.hyy.action;
 2 
 3 import com.opensymphony.xwork2.ActionSupport;
 4 
 5 public class HelloWorld extends ActionSupport{
 6     private String message;
 7     public String execute() {
 8         message = "hyy";
 9         return INPUT;
10     }
11 
12     public String getMessage() {
13         return message;
14     }
15 }

第9行

return INPUT,则会找/WEB-INF/content/hello-world-input.jsp

return SUCCESS,则会找/WEB-INF/content/hello-world-success.jsp

return "fail",则会找/WEB-INF/content/hello-world-fail.jsp

以此类推

posted @ 2014-08-08 10:51  无忧之路  阅读(185)  评论(0编辑  收藏  举报
无忧之路