Hi Ajib,
> public ActionForward execute(ActionMapping mapping, ActionForm inForm,
> HttpServletRequest request, HttpServletResponse response) throws Exception {
>
> // Get a list of characters associated with the select TV show
> String tvShow = (String) request.getParameter("tvShow");
> if (tvShow == null) {
> tvShow = "";
> }
>
// use a json lib, like: http://code.google.com/p/jjson/
// to generate json from an arrayList
List<String> character = getCharacters(tvShow);
JSONArray arr = new JSONArray();
for (String string : character) {
arr.add(new JSONString(string));
}
String responseString = arr.toJSON();
// use text/plain:
> response.setContentType("text/plain");
> PrintWriter out = response.getWriter();
// use response String
> out.println(responseString);
> out.flush();
>
> return null; // Not forwarding to anywhere, response is fully-cooked
>
> } // End execute()
>
> How can I avoid creating HTML in action class and send the Arraylist /JSON
> to view?
Similar to that. :-)
Cheers
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]