struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sharath karnati <karna...@yahoo.com>
Subject s:autocompleter not working in IE7.
Date Tue, 15 Dec 2009 21:52:30 GMT
Hi All,
 
   I'm trying s:autocompleter with below code
 
autocompleter.jsp file
 
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>Struts 2 Autocompleter Example!</title>
<s:head theme="ajax" />
</head>
<body>

<table cellpadding="0" cellspacing="5" width="95%"> 
<tr>
<td>
<b>Search Carrier:&nbsp;</b>
<!-- <s:textfield key="search_carrier" size="50" maxlength="100" /> -->
<s:url id="carrierList" action="AutocompleteField" method="searchAutoCarrier" />
<s:autocompleter name="search_carrier" theme="ajax" href="%{carrierList}" showDownArrow="false"
dropdownWidth="300" dropdownHeight="500" loadOnTextChange="true"/>
</td>
</tr>
</table> 

</body>
</html>
------------------------------------------------------------------------------
AutoCompleteAction.java having 
//Implemented for auto completer
public String searchAutoCarrier() throws Exception{
logger.info("Inside searchAutoCarrier method: "+search_carrier);
try{
//setServe_carriers(manageFormService.getServeDetails(complaint_key));
json = new HashMap<String,String>();

if(null!=search_carrier && search_carrier.trim().length()>2){
json.put("AB","Alabama");
json.put("AL","Alaska");
json.put("AR","Arizona");
json.put("AK","Arkansas");
json.put("CA","California");
json.put("CO","Colorado");
json.put("CN","Connecticut");
json.put("DL","Delaware");
json.put("DC","District of Columbia");
json.put("FL","Florida");
json.put("GE","Georgia");
json.put("HA","Hawaii");
json.put("ID","Idaho");
json.put("IL","Illinois");
json.put("IN","Indiana");
logger.info("Inside searchAutoCarrier method json size: "+json.size());
//setCarriers(results);
   if(json.size()<1){
     addActionError(getText("search_carrier_error"));
   }
}
else{
   addActionError(getText("search_carrier_invalid"));
  } 
}
catch (Exception e) {
logger.error("Exception in searchAutoCarrier: "+e.toString());
throw new Exception();
} 

return SUCCESS;
}//End of searchAutoCarrier method
 
 
private Map<String,String> json;

public Map<String, String> getJson() {
return json;
}

public void setJson(Map<String, String> json) {
this.json = json;
}
 
--------------------------------
 
In stuts.xml file
 
<action name="AutocompleteField!*" class="com.action.AutocompleteAction" method="{1}">
<result type="json"><param name="root">json</param></result>
</action>

<action name="autocompleter" class="com.action.AutocompleteAction">
<result>/pages/autocompleter.jsp</result>
</action> 
 
 
  In IE ,when I enter 'ala' it needs to display list of values which are starting with these
values but it is sending request to action but not displaying list of values in dropdown.
I checked this request with logger statement.
 
  The same code is working fine in Firefox browser(displaying list of values starting with
ala).
 
  I'm using struts2-core-2.0.11.jar and added jsonplugin-0[1].30.jar file.
 
  In struts package level added json-default.
  
<package name="app" extends="struts-default,json-default">
 
  Can anyone please let me know why this is not working in  IE and how to fix this problem.
I'm not even getting any javascript errors. 
 
  Thanks in advance.
 
Regards,
Sharath Karnati.
 
 


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message