I have struts2-json-plugin lib in my project and I want to use JSONWriter to get JSON string and put it to JavaScript for one parameter only (not JSON result for the all Action) only one getter:
public String getCarTypesJson() throws JSONException {
JSONWriter writer = new JSONWriter();
return writer.write(carTypes);
}
Its work but can I skip creation of new JSONWriter()
and inject JSONWriter
object in my Action from Struts2?