Hi Craig,
 
   I'm not looking for printing 'property' value here...
 
   say user types 'm' in text field then it should send request to action, 
action returns list of values starts with 'm', this list will be displayed in 
the same textfield where user entered character 'm'.
 
   I'd like to know, say we have java 'arraylist' which is having list of 
values starts with 'm' then how to assign this arraylist to textfield where 
user entered character 'm'...
 
  When I tried same thing it is returning entire page(ajax.jsp), my action is 
having below method
 
public String selectDropDown()
{
logger.info("Inside AjaxAction selectDropDown: ");

list = new ArrayList<String>();
list.add("one-1");
list.add("two-2");
list.add("three-3");
list.add("four-4");
list.add("five-5");

return "dropdown";

}//End of selectDropDown
 
 
and in action 
 
<action name="giveMeJsonData" class="gov.action.AjaxAction" method="{1}">
    <result name="dropdown">/pages/ajax.jsp</result>
</action>    
 
   It should return only list from this method when I call 'selectDropDown' 
method from ajax page. Can you please let me know, how to do this.
 
   Thanks in advance.
 
Regards,
Sharath.
 

--- On Thu, 4/22/10, Craig Ricciuto <cricci...@symboticware.com> wrote:


From: Craig Ricciuto <cricci...@symboticware.com>
Subject: Re: Jquery autocomplete with struts2.
To: "Struts Users Mailing List" <user@struts.apache.org>
Cc: karna...@yahoo.com
Date: Thursday, April 22, 2010, 10:44 AM


Could you not do exactly what he is doing but instead of calling the .php file 
you call your action.

As for the action itself, you would make it like any other action and just 
store what you want to show the user into a variable with the proper 
getter/setter function so in the jsp you can go:

<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="VARIABLENAMEHERE"/>

The JSP would only contain that. I don't have time to create an example so 
sorry but this should be enough info.


On Thu, Apr 22, 2010 at 10:33 AM, sharath karnati <karna...@yahoo.com> wrote:

Hi All,
 
   I'm trying to use Jquery autocomplete with struts2. The example for using 
Jquery autocomplete is given below(link)
 
       http://makhaer.blogspot.com/2008/12/jquery-autocomplete.html
 
   In this example, author is returning data with .php similarly I'd like to 
return data from struts2 action(not with json object)
 
   Can anyone please let me know how to return data from struts2 action for 
accomplishing same thing.
 
   Thanks in advance.
 
Regards,
Sharath.


      

Reply via email to