Is it a dynamic value you need to set or could you use dependency
injection?
S
On Thu, Mar 6, 2008 at 6:06 AM, GF <[EMAIL PROTECTED]> wrote:
> I want to do a simple thing,
> I have an action like this
>
> public class MyAction {
> private String myVar;
>
> public setMyVar(String myVar) {
> this.myVar = myVar;
> }
> }
>
> Inside my Interceptor i want to put in my Action a string inside myVar
> property of the Action.
> In few words, I need to discover if the Action has that setter, and if
> its parameter type is a "String", in this case I would call that
> setter.
>
> I know how to write the interceptor but i don't know how to "try" to
> set a property on the action.
>
> Can you give me any good link?
> I tried to watch the source of : StaticParametersInterceptor that
> should do something like I have to do.
>
> It does:
> // for actions marked as Parameterizable, pass the static
> parameters directly
> if (action instanceof Parameterizable) {
> ((Parameterizable) action).setParams(parameters);
> }
>
> if (parameters != null) {
> final ValueStack stack = ActionContext.getContext
> ().getValueStack();
>
> for (Iterator iterator = parameters.entrySet().iterator();
> iterator.hasNext();) {
> Map.Entry entry = (Map.Entry) iterator.next();
> stack.setValue(entry.getKey().toString(), entry.getValue
> ());
> Object val = entry.getValue();
> if (parse && val instanceof String) {
> val = TextParseUtil.translateVariables((String) val,
> stack);
> }
> stack.setValue(entry.getKey().toString(), val);
> }
> }
>
> Where does it call the "action setters"?
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Scott
[EMAIL PROTECTED]