struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken McWilliams <ken.mcwilli...@gmail.com>
Subject Struts2 annotation with parameter when using json plugin
Date Fri, 14 Sep 2012 05:58:33 GMT
Simply I want to evaluate a property of my action and use it's value
within an annotation. The following is exactly where I want to use it:

I want to define a excludeProperties parameter at run time.

Consider the following annotation which currently works on the action:
@Result(name = "success", type = "json", params = {"root", "model",
"excludeProperties", "myCollection"})

There the actions model has a myCollection collection which I do not
want serialized.

However I would like to create an exclusion String (a string will do for now).

If I create a getter setter for exclusion, I would expect the
following annotation to work (which does not):

@Result(name = "success", type = "json", params = {"root", "model",
"excludeProperties", "${exclusion}"})

Any ideas?

I am using the named variable pattern matcher to extract values from
the namespace if that matters, I think it should just affect request
parameters.

I really want to dynamically set the exclude properties of the result.
I have not tried with XML yet, but shouldn't think it would be
different. Is is possible to directly create and set the methods of
the result type? Because that could be another option.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message