Struts 1 or Struts 2? Assuming Struts 2, I'll answer as best as I can.
You'll have to code an action around calling this 'method.' For instance, say the method you want to call is in a class called Foo and the method is called bar(). If the result of bar() is a String and this result is what you're looking for, then the pseudo-code would look something like this - In struts.xml - <action name="FooCall" class="FooAction" > <result>/your/jsp/dir/aJSP.jsp</result> </action> In Foo.java - public class BaseAction extends ActionSupport { private String result ; public String execute() { Foo foo = new Foo(); String newResult = foo.bar(); this.setResult(newResult); } public getResult() { return result; } public setResult(String newResult) { this.result = newResult; } } In aJSP.jsp - <%@ taglib uri="/struts-tags" prefix="s" %><s:property value="result" /> Feel free to criticize if I'm off-base, I have thick skin ;-) Basically, at this point, you would still need to write your AJAXy code which would point to http://yourserver/yourWebApp/FooCall.action > -----Original Message----- > From: Monttez [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 13, 2007 1:30 PM > To: user@struts.apache.org > Subject: Ajax - obtaining a method result > > Hi all > > I want to make an ajax call to a method and get its > returning.. (for use > in a javascript fragment) > > > For example: I want to get the Id for the inserted person (in an ajax > insert..).. > > > How it is possible? > > > This method could be in an action or directly in my Service class.. > > > > Thanks in advance > > Luciano > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
smime.p7s
Description: S/MIME cryptographic signature