我想使用dojo autocompleter做一個信息哈希表的ajax檢索,但似乎沒有顯示在下拉菜單上。請幫助如何使用ajax顯示DOJO Autocompleter值
我的JSP代碼:
<sx:head/>
.......
<s:url id="companyList" action="AjaxAutoCompleteCompanyPOCAction" />
<sx:autocompleter name="company" href="%{companyList}" size="24" loadOnTextChange="true" preload="false" loadMinimumCount="1" showDownArrow="false" autoComplete="false" searchType="substring" key="rental.company"/>
我的struts.xml:
<action name="AjaxAutoCompleteCompanyPOCAction" class="com.kodi.action.jobs.AjaxAutoCompleteCompanyPOCAction" method="retrieveListOfCompany" >
<result type="json">
<param name="root">json</param>
</result>
</action>
我的行動
public String retrieveListOfCompany(){
//if(KodiUtil.isMatch(getCompany())){ // validate special char
setJson(new HashMap<String, String>()); // create a JSON hashmap
if(company != null && company.length() > 0) { // check if string is empty
List<CompanyEntity> companylist = manager.retrieveCompanyName(getCompany()); // retrieve the companies name
for (CompanyEntity companies : companylist){
getJson().put(companies.getCompany_name(),""+companies.getCompany_id());
}
}
return "SUCCESS";
}
截至目前,代碼中並調用retrieveListOfCompany()在我的Action類,n獲取數據,但它不顯示在JSP頁面上..請幫助.. 我正在獲取是錯誤,
No result defined for action com.kodi.action.jobs.AjaxAutoCompleteCompanyPOCAction and result SUCCESS
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
,但是當我在struts.xml我設置爲
<result name="SUCCESS" type="json">
<param name="root">json</param>
</result>
我得到這個=(
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:373)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
我使用Struts2的,泥鰍插件-2.1。 8.1.jar
謝謝!
你有使用道場插件? –
不是真的..似乎easiler tho,但它只是不能工作=( – user1103164
其實我不會介意幫助你,但你已經問了4個問題,並且都沒有接受任何一個 –