2012年4月12日 星期四

Sturt2 ZeroConfing

資料來源struts-2-hello-world-annotation-example

@Namespace("/User")//nameSpace很重要 沒設好mapping不到
@ResultPath(value="/")
@Result(name="success",location="pages/login.jsp")
public class LoginAction extends ActionSupport{

 @Action(value="testLogin", results={
   @Result(name="success",location="pages/test.jsp")
 })
 public String test() {

  return SUCCESS;

 }
 
 @Action(value="testLogin2", results={
   @Result(name="success",location="pages/test2.jsp")
 })
 public String test2() {

  return SUCCESS;

 }
 
}

ZeroConfig 的InterCeptor還是要配sturts.xml
@Action(value="store", interceptorRefs=@InterceptorRef("store"))
public String store() throws Exception
{
    ....
}

沒有留言:

張貼留言