It's a string array, so casting to String[] will work, which makes sense since you can have multiple params with the same name.

Paul Knepper wrote:

Ok, I can get the param with ActionContext.getContext().getParameters().

But when I try to cast the object returned from the param Map to a String I get a class cast exception.

Check this out.

Map params = ctx.getParameters();
Object objMyParam = params.get("myParam");
log.finer("objMyParam class = " + objMyParam.getClass().getName());

returns -> FINER: objMyParam class = [Ljava.lang.String;


If I do the following: String strMyParam = ""; log.finer("strMyParam class = " + strMyParam.getClass().getName());

returns -> FINER: strMyParam class = java.lang.String

I don't understand what is being returned from the param class? What is [Ljava.lang.String; and how do I get a simple String from the param map?

Thanks,
Paul


-----Original Message----- From: Jason Carreira [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:02 PM To: [EMAIL PROTECTED] Subject: RE: [OS-webwork] request params in an interceptor


ActionContext.getContext().getParameters()



-----Original Message-----
From: Paul Knepper [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 4:52 PM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] request params in an interceptor



How do I get request params in my interceptor?


Say I have a url of, http://blah/myAction.action?myParam=foo

In my interceptor I tried:

ActionContext ctx = ActionContext.getContext();
String myParam = (String)ctx.get("myParam");

myParam was null.

Thanks,
Paul



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to