struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: [S2] ParametersInterceptor: Error setting expression
Date Tue, 05 Feb 2008 11:23:18 GMT
The referenced tutorial looks fine.

I'd remove the interceptor first and ensure everything works without 
it.  (confirm that you can post to the index action)
Then add the login and see if that causes the exception.
I'd probably insert the login interceptor before the param interceptor 
myself as this particular example doesn't need to write to the action on 
a failure.

struts-default.xml is available on this page:
http://struts.apache.org/2.x/docs/interceptors.html

hezjing wrote:
> Actually, I'm following the tutorial described at
> http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor.
>
> May I know which file that is showing the Struts2 default interceptor stack?
>
> Thanks for your help!
>
>
> On 2/5/08, Jeromy Evans <jeromy.evans@blueskyminds.com.au> wrote:
>   
>> That looks fine.  Do you have an action called index in the default
>> namespace?  It's calling ActionSupport which is the default/fallback
>> action under some circumstances.
>>
>> You may need to go back to the default interceptor stack to isolate
>> what's wrong. Or post the package from struts.xml here.
>>
>> PS. [Ljava.lang.String;@18a270a is an array of strings. This should if you're using
the default conversion.
>>
>>
>> hezjing wrote:
>>     
>>> Hmmm ... my login.jsp now looks like this,
>>>
>>> <s:form action="index" method="post" validate="true">
>>>   <s:textfield name="username" key="user.username" />
>>>   <s:password name="password" key="user.password" />
>>>   <s:submit name="login" key="button.login" />
>>> </s:form>
>>>
>>>
>>> When the login button is pressed, the following exceptions are shown
>>> in the console,
>>>
>>> com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
>>> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
>>> caught setting 'login' on 'class
>>> com.opensymphony.xwork2.ActionSupport: Error setting expression
>>> 'login' with value '[Ljava.lang.String;@223be4'
>>>
>>> com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
>>> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
>>> caught setting 'password' on 'class
>>> com.opensymphony.xwork2.ActionSupport: Error setting expression
>>> 'password' with value '[Ljava.lang.String;@18a270a'
>>>
>>> com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
>>> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
>>> caught setting 'username' on 'class
>>> com.opensymphony.xwork2.ActionSupport: Error setting expression
>>> 'username' with value '[Ljava.lang.String;@10936a1'
>>>
>>>
>>>
>>>
>>> On 2/5/08, Jeromy Evans <jeromy.evans@blueskyminds.com.au> wrote:
>>>
>>>       
>>>> It depends what your interceptor is trying to do...
>>>> At the moment, I still think params is trying to call
>>>> getButton().setLogin(val) on your ACTION (prior to execution of your
>>>> login interceptor).
>>>> I presume your interceptor is going to check the params or session and
>>>> redirect if not authenticated, which is fine, but with your stack the
>>>> params interceptor will attempt to write to the ACTION first.
>>>>
>>>> I still suspect your JSP/html includes a field with NAME "button.login"
>>>> and params is throwing the exception due to getButton().  You can test
>>>> my theory by giving the field a different name (eg. key="button.login"
>>>> name="login") that won't cause an error.
>>>>
>>>> hezjing wrote:
>>>>
>>>>         
>>>>> The "button.login" is a key in i18n properties file, and it is suppose
>>>>> to retrieve the label for a button.
>>>>>
>>>>> I suspect this problem could be the interceptor statck I configured,
>>>>>
>>>>>         <interceptor-ref name="servlet-config" />
>>>>>         <interceptor-ref name="params" />
>>>>>         <interceptor-ref name="login" /> // my interceptor
>>>>>         <interceptor-ref name="prepare" />
>>>>>         <interceptor-ref name="chain" />
>>>>>         <interceptor-ref name="model-driven" />
>>>>>         <interceptor-ref name="fileUpload" />
>>>>>         <interceptor-ref name="static-params" />
>>>>>         <interceptor-ref name="params" />
>>>>>         <interceptor-ref name="conversionError" />
>>>>>         <interceptor-ref name="validation" />
>>>>>         <interceptor-ref name="workflow" />
>>>>>
>>>>>
>>>>> Is it OK if my login interceptor is configured after the params interceptor?
>>>>>
>>>>>
>>>>> On 2/5/08, Jeromy Evans <jeromy.evans@blueskyminds.com.au> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> A param called "button.login" means the ParametersInterceptor has
to
>>>>>> call getButton().setLogin(val).
>>>>>>
>>>>>> If you don't have a getButton() method, or getButton() returns null,
an
>>>>>> exception like this occurs while trying to set the parameter.
>>>>>>
>>>>>> hezjing wrote:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> Hi
>>>>>>>
>>>>>>> I'm trying to create a login interceptor.
>>>>>>>
>>>>>>> When a login form is submitted, I got the following exception:
>>>>>>>
>>>>>>> com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
>>>>>>> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
>>>>>>> caught setting 'button.login' on 'class
>>>>>>> com.opensymphony.xwork2.ActionSupport: Error setting expression
>>>>>>> 'button.login' with value
>>>>>>> '[Ljava.lang.String;@2d4c7e'
>>>>>>>
>>>>>>>
>>>>>>> What does this exception means?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>
>>>>
>>>>         
>>>
>>>       
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message