Have you considered using an include? You can call a json-result-type action
with it or switch to some other fragment result if needed. Perhaps it's
quick and dirty compared with creating a custom tag but it seems to me it
would be a lot easier to implement.

- Aaron
 On Jan 3, 2011 6:50 AM, "Jim Talbut" <jim.tal...@groupgti.com> wrote:
> Hi,
>
> I keep needing to put the JSON equivalent of an expression into a JSP page
to be used by client side javascript.
> This is done during the evaluation of the JSP, it's not AJAX.
>
> At the moment I'm doing it by creating a special "get" method on the
action, but that's not nice - the action shouldn't need to know that I want
the representation in JSON.
>
> I've started looking at creating an alternative tag to do the job, but it
would be pretty much a complete copy of the property tag, but with an
additional "escape"-type property to specify that the result should be JSON.
> It's slightly more complicated than that because the normal escapes should
be applied afterwards too.
>
> Question: Is this something that should be implemented in the base
property tag as an enhancement to struts itself, or should I just copy the
property tag and get on with my life?
>
> Thanks
> Jim

Reply via email to