Struts2 Convention插件的使用(3)方法前的@Action注解

package com.hyy.action;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldTest extends ActionSupport{
    private String message;
    
    @Action("/different/url")
    public String test() {
        message = "hyy";
        return "fail";
    }

    public String getMessage() {
        return message;
    }
}

由原本的/hello-world-test变为/differrent/url

相应地,返回的视图是/WEB-INF/differrent/url.jsp

posted @ 2014-08-08 11:15  无忧之路  阅读(253)  评论(0编辑  收藏  举报
无忧之路