Codebehind プラグインを使用して Struts 2 のアクションとしてメソッドにアクセスできますか? struts.xml
ファイルがなくaction!method
、URL のように機能するためです。
メソッドにアクセスしたいだけです
クラスで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データを取得するには?