--- j alex <[EMAIL PROTECTED]> wrote:
> Thanks , i didn't want to have the request parameters as javabeans within
> the Action because they are used only for one-time checks and based  on
> their values, some other Action properties are set. The parameter names
> could change later, and i didn't want that to affect  the Action.

You'd have to change the code anyway, and IMO it's messier and more
error-prone to use hard-coded strings like you're doing.

> Now, i tried the following to retrieve the params from ActionContext (did
> not implement ParametersAware or SessionAware)
> 
> Map requestParams = ActionContext.getContext().getParameters();
> 
> productCodes = new String[] {(String) requestParams.get("param1"), (String)
> requestParams.get("param2")},
> 
> This gives the following exception :
> 
> java.lang.ClassCastException: [Ljava.lang.String; incompatible with
> java.lang.String
> 
> can't figure what's going on here..

...

When I run across something like that I take the following approach:

Q: Why am I getting a class-cast exception?
A: I'm getting String[] instead of a single String.

Q: What's in the String[] I'm actually getting?
A: [Uses logging or debugger to find out]

That's usually enough to answer the question.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to