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
本文出自 无忧之路 - 博客园