You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Hamacher <er...@enetrix.com> on 2008/06/26 15:42:22 UTC

Struts 2 - Unexpected Exception

Hello again:

I have the following Action:


public class PrepAction extends ActionSupport {

String param_1 = null;

public String execute() {
System.err.println("In prep execute");
return SUCCESS;
}


public void setParam_1(String param_1) {
this.param_1 = param_1;
}

public String getParam_1() {
return param_1;
}
}

Yet when I call /ImageManager/upload/PrepAction.action?param_1=123, I
get the following message:

SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
caught setting 'param_1' on 'class
com.opensymphony.xwork2.ActionSupport: Error setting expression
'param_1' with value '[Ljava.lang.String;@1116f9'

What am I missing?

Thanks.
eric

 

Regards,

Eric Hamacher

 

******************************

THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE ADDRESSEE(S), AND MAY
CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. INTERCEPTION,
COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE ADDRESSEE(S) IS
PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY LAWS. IF YOU
RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY ME BY RETURN
EMAIL TO eric.hamacher@enetrix.com *******************************

 


Re: Struts 2 - Unexpected Exception

Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/6/26 Jim Kiley <jh...@summa-tech.com>:
> I believe what Lukasz is trying to get across is that when Struts sees the
> underscore in the submitted data it assumes that it is working with a
> collection or array of some kind.  The fact that it referred to your value
> as '[Ljava.lang.String' rather than the String's actual value is the tipoff
> there -- the "[Lclassname" format is Java's String representation of an
> array.

Khe? In my opinion is just value of reference, see toString() implementation.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: Struts 2 - Unexpected Exception

Posted by Jim Kiley <jh...@summa-tech.com>.
I believe what Lukasz is trying to get across is that when Struts sees the
underscore in the submitted data it assumes that it is working with a
collection or array of some kind.  The fact that it referred to your value
as '[Ljava.lang.String' rather than the String's actual value is the tipoff
there -- the "[Lclassname" format is Java's String representation of an
array.

jk

On Thu, Jun 26, 2008 at 9:47 AM, Lukasz Lenart <lu...@googlemail.com>
wrote:

> > What am I missing?
>
> Name of the parameter, change it to param1 and getter/setter
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

AW: Something like getCurrentAction(...)

Posted by Jan Froehlich <Ja...@infomotion.de>.
I'm sorry - found it...... 
Just ignore my last message!

That will return an object of this type:

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts
2/dispatcher/mapper/ActionMapping.html

musachy

On Thu, Jun 26, 2008 at 11:21 AM, Jan Froehlich
<Ja...@infomotion.de> wrote:
> Can you give me a quick hint, how I can access what I need? Not sure
> what I should search for....
>
> Try this:
>
>
http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
> -action-name-or-namespace-from-a-view.html
>
> On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
> <Ja...@infomotion.de> wrote:
>> Something I forgot to tell....
>>
>> I already tried the way using the <s:property value="#action" /> but
> as
>> I use a default action for most of my calls its not a possibility...
>>
>>
>>
>> Hi all,
>>
>> As I am not sure if I can explain the whole context of my problem
just
> a
>> short description of what I got and what I want:
>> I got an Action extending ActionSupport where I added a
>> getCurrentAction() method.
>>
>>        public String getCurrentAction() {
>>                String sRequestURL =
>> getRequest().getRequestURL().toString();
>>                return
>> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
>> sRequestURL.length() - 1);
>>        }
>>
>> The problem (with tiles I guess) is that I always get the url from my
>> tiles master template and not from the action that was called.
>> After I debugged the request object I found an array called
>> "specialAttributes" where I found the action name.
>>
>> Is it possible to access those specialAttributes, or is there any
> other
>> way?
>>
>> Regards
>> Jan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


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


AW: Something like getCurrentAction(...)

Posted by Jan Froehlich <Ja...@infomotion.de>.
Well, ok - found that already - but I got no Idea what method returns my
desired action.

That will return an object of this type:

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts
2/dispatcher/mapper/ActionMapping.html

musachy

On Thu, Jun 26, 2008 at 11:21 AM, Jan Froehlich
<Ja...@infomotion.de> wrote:
> Can you give me a quick hint, how I can access what I need? Not sure
> what I should search for....
>
> Try this:
>
>
http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
> -action-name-or-namespace-from-a-view.html
>
> On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
> <Ja...@infomotion.de> wrote:
>> Something I forgot to tell....
>>
>> I already tried the way using the <s:property value="#action" /> but
> as
>> I use a default action for most of my calls its not a possibility...
>>
>>
>>
>> Hi all,
>>
>> As I am not sure if I can explain the whole context of my problem
just
> a
>> short description of what I got and what I want:
>> I got an Action extending ActionSupport where I added a
>> getCurrentAction() method.
>>
>>        public String getCurrentAction() {
>>                String sRequestURL =
>> getRequest().getRequestURL().toString();
>>                return
>> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
>> sRequestURL.length() - 1);
>>        }
>>
>> The problem (with tiles I guess) is that I always get the url from my
>> tiles master template and not from the action that was called.
>> After I debugged the request object I found an array called
>> "specialAttributes" where I found the action name.
>>
>> Is it possible to access those specialAttributes, or is there any
> other
>> way?
>>
>> Regards
>> Jan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


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


Re: Something like getCurrentAction(...)

Posted by Musachy Barroso <mu...@gmail.com>.
That will return an object of this type:

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/ActionMapping.html

musachy

On Thu, Jun 26, 2008 at 11:21 AM, Jan Froehlich
<Ja...@infomotion.de> wrote:
> Can you give me a quick hint, how I can access what I need? Not sure
> what I should search for....
>
> Try this:
>
> http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
> -action-name-or-namespace-from-a-view.html
>
> On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
> <Ja...@infomotion.de> wrote:
>> Something I forgot to tell....
>>
>> I already tried the way using the <s:property value="#action" /> but
> as
>> I use a default action for most of my calls its not a possibility...
>>
>>
>>
>> Hi all,
>>
>> As I am not sure if I can explain the whole context of my problem just
> a
>> short description of what I got and what I want:
>> I got an Action extending ActionSupport where I added a
>> getCurrentAction() method.
>>
>>        public String getCurrentAction() {
>>                String sRequestURL =
>> getRequest().getRequestURL().toString();
>>                return
>> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
>> sRequestURL.length() - 1);
>>        }
>>
>> The problem (with tiles I guess) is that I always get the url from my
>> tiles master template and not from the action that was called.
>> After I debugged the request object I found an array called
>> "specialAttributes" where I found the action name.
>>
>> Is it possible to access those specialAttributes, or is there any
> other
>> way?
>>
>> Regards
>> Jan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


AW: Something like getCurrentAction(...)

Posted by Jan Froehlich <Ja...@infomotion.de>.
Can you give me a quick hint, how I can access what I need? Not sure
what I should search for....

Try this:

http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
-action-name-or-namespace-from-a-view.html

On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
<Ja...@infomotion.de> wrote:
> Something I forgot to tell....
>
> I already tried the way using the <s:property value="#action" /> but
as
> I use a default action for most of my calls its not a possibility...
>
>
>
> Hi all,
>
> As I am not sure if I can explain the whole context of my problem just
a
> short description of what I got and what I want:
> I got an Action extending ActionSupport where I added a
> getCurrentAction() method.
>
>        public String getCurrentAction() {
>                String sRequestURL =
> getRequest().getRequestURL().toString();
>                return
> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
> sRequestURL.length() - 1);
>        }
>
> The problem (with tiles I guess) is that I always get the url from my
> tiles master template and not from the action that was called.
> After I debugged the request object I found an array called
> "specialAttributes" where I found the action name.
>
> Is it possible to access those specialAttributes, or is there any
other
> way?
>
> Regards
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


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


Re: Something like getCurrentAction(...)

Posted by Musachy Barroso <mu...@gmail.com>.
Try this:

http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation-action-name-or-namespace-from-a-view.html

On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
<Ja...@infomotion.de> wrote:
> Something I forgot to tell....
>
> I already tried the way using the <s:property value="#action" /> but as
> I use a default action for most of my calls its not a possibility...
>
>
>
> Hi all,
>
> As I am not sure if I can explain the whole context of my problem just a
> short description of what I got and what I want:
> I got an Action extending ActionSupport where I added a
> getCurrentAction() method.
>
>        public String getCurrentAction() {
>                String sRequestURL =
> getRequest().getRequestURL().toString();
>                return
> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
> sRequestURL.length() - 1);
>        }
>
> The problem (with tiles I guess) is that I always get the url from my
> tiles master template and not from the action that was called.
> After I debugged the request object I found an array called
> "specialAttributes" where I found the action name.
>
> Is it possible to access those specialAttributes, or is there any other
> way?
>
> Regards
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


AW: Something like getCurrentAction(...)

Posted by Jan Froehlich <Ja...@infomotion.de>.
Something I forgot to tell....

I already tried the way using the <s:property value="#action" /> but as
I use a default action for most of my calls its not a possibility...



Hi all,

As I am not sure if I can explain the whole context of my problem just a
short description of what I got and what I want:
I got an Action extending ActionSupport where I added a
getCurrentAction() method.

	public String getCurrentAction() {
		String sRequestURL =
getRequest().getRequestURL().toString();
		return
sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
sRequestURL.length() - 1);
	}

The problem (with tiles I guess) is that I always get the url from my
tiles master template and not from the action that was called.
After I debugged the request object I found an array called
"specialAttributes" where I found the action name.

Is it possible to access those specialAttributes, or is there any other
way?

Regards
Jan

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


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


Something like getCurrentAction(...)

Posted by Jan Froehlich <Ja...@infomotion.de>.
Hi all,

As I am not sure if I can explain the whole context of my problem just a
short description of what I got and what I want:
I got an Action extending ActionSupport where I added a
getCurrentAction() method.

	public String getCurrentAction() {
		String sRequestURL =
getRequest().getRequestURL().toString();
		return
sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
sRequestURL.length() - 1);
	}

The problem (with tiles I guess) is that I always get the url from my
tiles master template and not from the action that was called.
After I debugged the request object I found an array called
"specialAttributes" where I found the action name.

Is it possible to access those specialAttributes, or is there any other
way?

Regards
Jan

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


Re: Struts 2 - Unexpected Exception

Posted by Lukasz Lenart <lu...@googlemail.com>.
> What am I missing?

Name of the parameter, change it to param1 and getter/setter


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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