Hi all, I have an Action class which has basic CRUD methods in it. I'm using convention plugin. I want to ajax-call list, save, and delete methods using dojo rpc. (I included my UsersAction class below). I did these kind of things in php, but it is, at least for now, very difficult for me to understand struts way.
What i understood from http://cwiki.apache.org/S2PLUGINS/json-plugin.html documentation is first, I have to annotate these functions (list, delete, save) as @SMDMethod. 2- Specify mappings. Here i have 3 problems. The example given on that page is: <s:url id="*smdUrl*" namespace="/nodecorate" action="SMDAction" /> (in my case SMDAction is UsersAction) <script type="text/javascript"> //load dojo RPC dojo.require("dojo.rpc.*"); var service = new dojo.rpc.JsonService("${*smdUrl*}"); --------------------------- a) Can I extend the first line as <s:url id="smdUrl" namespace="/nodecorate" action="SMDAction" *method="list"*/> (save ,delete also) and NOT define any interceptors? b) If I have to define interceptors is it gonna be something like this @InterceptorRefs({ @InterceptorRef("list"), @InterceptorRef("save") @InterceptorRef("delete") }) on the class. c) Doc says: Add the map inside a package that extends "json-default"<package name="example" extends=" *json-default*"> <action name="JSONExample" class="example.JSONExample"> <result type="json"/> </action> </package> Do i need this extends parameter? If so, how can i use it with convention plugin? One more thing: Which libs do i need: Just jsonplugin-0.32.jar* *and struts2-dojo-plugin-2.1.5.jar. What is the purpose of json-lib-2.1.jar? This is my UsersAction class: public class UsersAction extends ActionSupport { private List<User> users; private UserService service; @Action(value="/admin/users", result...@result(name="success", type="redirect", location="/admin/users/list")}) public String execute() { service = new UserService(); return SUCCESS; } @Action(value="/admin/users/list", result...@result(name="success", type="tiles", location="admin.users")}) public String list() { users = service.findUserEntities(); return SUCCESS; } public String save() {............} public String delete() {............} } Thanks for your help in advance.