我可以使用代碼隱藏插件在Struts2中訪問方法嗎?由於URL中沒有struts.xml
文件及其作品爲action!method
。帶有代碼隱藏插件的Struts2的訪問路徑爲.action?
只是我不知道訪問的方法
請指教。如何在課堂上使用Struts標籤
"@Action(name="action"), <s:url action="action" method="method" />
類:
@Action(name = "JSONexample")
@Result(name="success",type=JSONResult.class,value="",params={"root","List"})
public class PartAction extends ActionSupport {
public String JSONexample{
-----
return SUCCESS;
}
public String readxml { }
}
如果我訪問下面的方法上提交按鈕點擊,我會得到JSON數據?
$.getJSON('ajax/sayHi.action', formInput,function(data)
所以我可以訪問URL中的動作爲localhost:7001/Sample/JSONmethod.action
獲取JSON數據?
不推薦使用codebehind插件;請考慮使用慣例或休息。 –