Hi All,
 
   Added below lines in struts.xml file
 
 
<package name="admin" extends="struts-default,json-default">  
<result-types>
       <result-type name="json" class="org.apache.struts2.json.JSONResult" />
</result-types>
 
<action name="Autocomplete!*" class="gov.admin.action.ManageAction" 
method="{1}">
          <result type="json"><param name="root">json</param></result>

</action> 

 
</package>
 
Added following lines .jsp file
 
<b>Search JSON:&nbsp;</b>
<s:url id="url" action="Autocomplete" method="getNames" />

<sx:autocompleter href="%{url}" loadOnTextChange="true" loadMinimumCount="3" />
 
 
even included <%@ taglib prefix="sx" uri="/struts-dojo-tags"%> and 
<head>
<sx:head />
</head>
 
When it builds the page it is showing below lines
 
<input dojoType="struts:ComboBox"  
dataUrl="/admin/Autocomplete!getNames.action" id="manageForm_" 
keyName="nullKey" loadOnType="true" loadMinimum="3" visibleDownArrow="true" />
<script language="JavaScript" 
type="text/javascript">djConfig.searchIds.push("manageForm_");</script>
 
after entering 3 or more characters it supposed to invoke 'getNames' method but 
it is not even starting invocation of this method....
 
Can anyone please let me know where I'm wrong.
 
Thanks in advance.
 
Regards,
Sharath.
 

 
 
 
 
 


--- On Fri, 4/16/10, Dale Newfield <d...@newfield.org> wrote:


From: Dale Newfield <d...@newfield.org>
Subject: Re: Using json in Struts 2.1.8.1
To: "Struts Users Mailing List" <user@struts.apache.org>
Date: Friday, April 16, 2010, 10:39 AM


> <package name="package_name" extends="struts-default"
> namespace="/namespace_name">
>         <result-types>
>             <result-type name="json" 
>class="com.googlecode.jsonplugin.JSONResult" />
>         </result-types>

Or just

<package name="package-name" extends="json-default">

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




      

Reply via email to