以下內容參考網上的資料
[b]間接實現零配置[/b]
編寫乙個基礎的action
public abstract class baseaction
public void settarget(string target)
protected string render(string _target)
}
public class useraction extends baseaction
public user getuser()
public void setuser(user user)
public string test()
}
訪問:[u]http://localhost:8080/workbench/user/test [/u]
[b]真正的夫配置,它是基於包的路徑的[/b]
原文:web.xml:
struts2
org.apache.struts2.dispatcher.filterdispatcher
actionpackages
demo.actions1,demo.actions2
struts2是通過"result"和"results"兩個類級別的annotations來指定results的。
@results(),
@result(name="error", type=nullresult.class, value = "/error.html", params = {})
})
public class listpeopleaction
}
[b]coc[/b]
struts2零配置 註解
一 配置web.xml struts2 org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter actionpackages com.test.action struts2 二 加入註解 namespace valu...
Struts2 零配置註解
2 action中可指定乙個value屬性。類似於指定屬性值 3 action中還可以指定乙個params屬性,該屬性是乙個字串陣列,用於該acion指定的引數名和引數值。params屬性應遵守如下格式 4 actions 也用於修飾action類裡的方法,用於將該方法對映到多個url.action...
struts2註解驅動 零配置
一 配置web.xml struts2 org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter actionpackages com.test.action 二 加入註解 namespace value test a...