On Tue, 02 Apr 2013 11:03:04 -0300, Tony Nelson <tnel...@starpoint.com> wrote:

    JSONObject onButton1Press(SimplePojo pojo) {
        logger.info(pojo.toString());
        return new JSONObject("response", "ok3");
    }

For this kind of parameter in an event handler method, Tapestry expects it to be in the event's activation context. I don't know of a JS implementation of Tapestry's URLEncoder, so I prefer to use query parameters in this case. In addition, ValueEncoder is usually (but not obligatorily) used for mapping objects to its ids, not to a String describing each of field values.

I thought maybe I could contribute a ValueEncoder but that only sees individual parameters, not the whole request.

Even this might work:

    JSONObject onButton1Press(JSONObject jsonObject) {
        SimplePojo pojo = SimplePojo.build(jsonObject);
        logger.info(pojo.toString());
        return new JSONObject("response", "ok4");
    }

Why don't you use a query parameter to pass a String containing a JSON-encoded object and then use the JSONObject(String string) to parse it?

--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to