日期:2014-05-17  浏览次数:20880 次

日本的seaser框架关于从action跳转到jsp需要配置什么,怎么配置
本人现在疑惑为什么项目找Action的时候直接找到IndexAction,我想找我自己写的Action,该怎么配置呢?求大神们指点
package jp.co.hitachi.twx21.astomi.action;

import org.seasar.struts.annotation.Execute;

public class IndexAction {

    @Execute(validator = false)
public String index() {
        return "index.jsp";
}
    @Execute(input = "index.jsp")
    public String submit() {
     return "pages/TWX-21_Portal.jsp";
    }
/*    @Execute(input = "pages/TWX-21_Portal.jsp")
    public String go() {
     return "pages/AMSAlertMngPartsSearch.jsp";
    }*/

}

注释部分我想重新写个Action,请问如何找到那个Action呢?
------解决方案--------------------
再往后,Seasar2将根据下述规则,将URL转换定位到对应的Action。
    * Web应用名之后的是请求的路径,/login/ , 将路径最后的/去掉,并加上Action后缀, 变成 loginAction
    * 将首字母转换为大写字母 loginAction  --〉LoginAction
    * 前置 RootPackage.action.
    * 通过上面3步的转换,Seasar2最终将、/login/ 这个URL映射到 tutorial.action.LoginAction 这个类。

如果请求URL中没有ActionPATH,框架会查找是否存在有 RootPackage.action.IndexAction这个类,并加载执行。http://localhost:8080/seasra2- tutorial/ 对应的Action就是 tutorial.action.IndexAction。补充,如果想让系统缺省调用IndexAction,要注意Web的根目录下不要存放有 index.jsp。其执行的优先度高于IndexAction。