Hi, I should probably listen your advice and first try to do without ajax. I was confusing lots of things. But maybe my last question on this topic, because i feel that it is almost working.
I have UsersAjaxAction class in actions.admin package. This is the class: (I'm basically trying to do pagination with ajax calls. I send parameters to list function based on the page number user clicked.) public class UsersAjaxAction extends ActionSupport { private List<User> users; private UserService service; public String smd() { return SUCCESS; } @SMDMethod public String list(int maxResult, int offset) { service = new UserService(); users = service.findUserEntities(maxResult, offset); return SUCCESS; } public List<User> getUsers() { return users; } } Then in my struts.xml I have this: <package name="actions.admin" namespace="/admin" extends="json-default"> <action name="UsersAjaxAction" class="actions.admin.UsersAjaxAction" method="smd"> <interceptor-ref name="json"> <param name="enableSMD">true</param> </interceptor-ref> <result type="json"> <param name="enableSMD">true</param> </result> </action> </package> Here, i'm not sure if the 'name' and 'namespace' parameters are correct. As i said my class is in actions.admin package. This is the generated html code where i make rpc call dojo.require("dojo.rpc.JsonpService"); var service = new dojo.rpc.JsonService("/myproject/admin/UsersAjaxAction"); //execute remote method defered.addCallback(callback); ................ I assume the line above matches to some action based on struts.xml, but I got the following error after i click the link which initiates javascript function. (Otherwise, the page renders ok. i see no error messages in eclipse console. but immediately after i clicked the link, i got this error. SEVERE: Servlet.service() for servlet default threw exception java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.get(Ljava/lang/Object;)Ljava/lang/Object; at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:157) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) Sorry for taking your time. If i'm writing too long and breaking some rules of the mailing list, please warn me. Don't worry i won't get offended. On Sat, Jan 10, 2009 at 4:17 PM, Musachy Barroso <musa...@gmail.com> wrote: > > 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? > > yes you can specify method in the url. You do not define interceptors > in the url, but the action mapping. > > > b) If I have to define interceptors is it gonna be something like this > > @InterceptorRefs({ > > @InterceptorRef("list"), > > @InterceptorRef("save") > > @InterceptorRef("delete") > > }) on the class. > > > > Do you have an interceptor stack for each method? I think you are > getting things mixed here. > > > 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> > > > > Create a package that extends the json package (it inherits the > results and interceptor there), and then use the @ParentPackage > ( > http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-ParentPackageannotation > ) > in your actions. > > > 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? > > You don't need json-lib. If you are just getting started this might be > confusing, I would suggest that you get the crud working with plain > html first, using convention, and then try to port it to JSON RPC, it > will be easier (and less frustrating if you are learning) > > musachy > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >