Hi All,
 
   I'm having following Action
 
-----------------  Action(Begin)     -----------------
public class AutocompleteField extends ActionSupport {

    private String city;
    private Map<String,String> json;

    public String execute() throws Exception() {
        return SUCCESS;
    }

    public String getCities() throws Exception() {
        json = new HashMap<String,String>();

        if(city != null && city.length() > 0) {
            CityDao dao = new CityDao();
            List<City> cities = dao.getCitiesStartingWith(city);
            for(City city : cities) {
                json.put(city.getId(), city.getName() + ", " + 
city.getState().getAbbreviation());
            }
        }

        return SUCCESS;
    }

    public void setCity(String city) {
        this.city = city;
    }

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

}

-----------------  Action(End)     -----------------
 
In struts.xml file I given following entries
 
<action name="Autocomplete!*" class="gov.action.AutocompleteField" method="{1}">
<!-- <result type="json"><param name="root">json</param></result> -->
<result name="success" type="json" /> 
</action>
 
When I keep 'jsonplugin-0.34.jar' file getting below error
 
  java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/TextUtils
 
After reading some posts, they said that we should not include this .jar in 
this new struts2.1.8 version. I removed this .jar file
 
 
I added 'struts2-dojo-plugin-2.1.8.1.jar' file in /WEB-INF/lib folder.
 
When I deploy the application getting below error
 
There is no result type defined for type 'json' mapped with name 'success'.  
Did you mean 'json'? - result
 
 Can anyone please let me know, how to define 'json' in struts.xml file? in 
package level I even added 'json-default'
 
<package name="admin" extends="struts-default,json-default">
 
 Thanks in advance.
 
Regards,
Sharath.
 


      

Reply via email to