Re: Iterate over an ArrayList of arrays

2010-05-11 Thread Thomas Lulé
It works !

Thank you very much.

2010/5/11 Steven Yang :
> try
> 
>                       ${top[0]}
>               
>
> On Tue, May 11, 2010 at 5:52 PM, Thomas Lulé  wrote:
>
>> I just found an ugly solution :
>>
>>        
>>                
>>                         
>>                                
>>                                        > />
>>                                
>>                                
>>                                        > />
>>                                
>>                        
>>                        ${text}
>>                
>>        
>>
>> 2010/5/11 Thomas Lulé :
>> > Hi,
>> >
>> > I've got an ArrayList named "breadcrumbs" in my action that
>> > I would like to display in my JSP.
>> >
>> > Something like :
>> >        
>> >                
>> >                        ${value[0]}
>> >                
>> >        
>> > I want to iterate over the ArrayList, then get the two values of the
>> > array, but this code obviously doesn't work.
>> >
>> > Do you have any better idea ?
>> >
>> > Thank you,
>> > Thomas
>> >
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>

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



Re: Iterate over an ArrayList of arrays

2010-05-11 Thread Thomas Lulé
I just found an ugly solution :











${text}



2010/5/11 Thomas Lulé :
> Hi,
>
> I've got an ArrayList named "breadcrumbs" in my action that
> I would like to display in my JSP.
>
> Something like :
>        
>                
>                        ${value[0]}
>                
>        
> I want to iterate over the ArrayList, then get the two values of the
> array, but this code obviously doesn't work.
>
> Do you have any better idea ?
>
> Thank you,
> Thomas
>

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



Iterate over an ArrayList of arrays

2010-05-11 Thread Thomas Lulé
Hi,

I've got an ArrayList named "breadcrumbs" in my action that
I would like to display in my JSP.

Something like :


${value[0]}


I want to iterate over the ArrayList, then get the two values of the
array, but this code obviously doesn't work.

Do you have any better idea ?

Thank you,
Thomas

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



Re: Struts 2 : redirect to action method on type conversion fail ?

2010-05-10 Thread Thomas Lulé
Nevermind, my stacktrace came from that issue :
https://issues.apache.org/jira/browse/WW-2850

2010/5/10 Thomas Lulé :
> One last thing :
>
> Even if everything works, I still get a stacktrace when I submit the
> form to save my object.
>
> I think that the params interceptor tries to set the properties of the
> object "jspProfile" I have in my form (with  name="jspProfile.recpCheckErrorCount"/> for example), before the
> prepare interceptor initialize that object.
>
> Even if I initialize the object in the action's constructor, I get the stack.
>
> 2010-05-10 12:34:12,062 [http-8080-Processor24] WARN
> com.opensymphony.xwork2.ognl.OgnlValueStack  - Error setting value
> ognl.OgnlException: target is null for setProperty(null,
> "recpCheckErrorCount", [Ljava.lang.String;@62812d)
>        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651)
>        at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>        at ognl.SimpleNode.setValue(SimpleNode.java:246)
>        at ognl.ASTChain.setValueBody(ASTChain.java:172)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>        at ognl.SimpleNode.setValue(SimpleNode.java:246)
>        at ognl.Ognl.setValue(Ognl.java:476)
>        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
>        at 
> com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155)
>        at 
> com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143)
>        at 
> com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:273)
>        at 
> com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187)
>        at 
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
> ...
>
> 2010/5/10 Thomas Lulé :
>> It works.
>>
>> Thanks a lot Lukasz and Alex.
>>
>> 2010/5/10 Alex Rodriguez Lopez :
>>> Hi Thomas,
>>>
>>> use the paramsPrepareParams interceptor stack (or change yours), from
>>> struts-default.xml:
>>>
>>> 
>>>            
>>> ...
>>>
>>> I think this accomplishes what you are looking for (of course you need
>>> setters for the parameters that you want params interceptor to have ready
>>> for you by the time the prepare() method is called).
>>>
>>> Em 10-05-2010 09:39, Thomas Lulé escreveu:
>>>>
>>>> That interceptor looks great, but is there any way to access request
>>>> parameters in the prepare() method ?
>>>>
>>>> The http request provides an "archiveProfileId" parameter and I use
>>>> that parameter to load my object "archiveProfile".
>>>>
>>>> 2010/5/10 Lukasz Lenart:
>>>>>
>>>>> Use Preparable interface instead
>>>>>
>>>>> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
>>>>>
>>>>>
>>>>> Regards
>>>>> --
>>>>> Łukasz
>>>>> http://www.lenart.org.pl/
>>>>> Kapituła Javarsovia 2010
>>>>> http://javarsovia.pl
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>
>>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>

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



Re: Struts 2 : redirect to action method on type conversion fail ?

2010-05-10 Thread Thomas Lulé
One last thing :

Even if everything works, I still get a stacktrace when I submit the
form to save my object.

I think that the params interceptor tries to set the properties of the
object "jspProfile" I have in my form (with  for example), before the
prepare interceptor initialize that object.

Even if I initialize the object in the action's constructor, I get the stack.

2010-05-10 12:34:12,062 [http-8080-Processor24] WARN
com.opensymphony.xwork2.ognl.OgnlValueStack  - Error setting value
ognl.OgnlException: target is null for setProperty(null,
"recpCheckErrorCount", [Ljava.lang.String;@62812d)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.ASTChain.setValueBody(ASTChain.java:172)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
at 
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155)
at 
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143)
at 
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:273)
at 
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187)
at 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
...

2010/5/10 Thomas Lulé :
> It works.
>
> Thanks a lot Lukasz and Alex.
>
> 2010/5/10 Alex Rodriguez Lopez :
>> Hi Thomas,
>>
>> use the paramsPrepareParams interceptor stack (or change yours), from
>> struts-default.xml:
>>
>> 
>>            
>> ...
>>
>> I think this accomplishes what you are looking for (of course you need
>> setters for the parameters that you want params interceptor to have ready
>> for you by the time the prepare() method is called).
>>
>> Em 10-05-2010 09:39, Thomas Lulé escreveu:
>>>
>>> That interceptor looks great, but is there any way to access request
>>> parameters in the prepare() method ?
>>>
>>> The http request provides an "archiveProfileId" parameter and I use
>>> that parameter to load my object "archiveProfile".
>>>
>>> 2010/5/10 Lukasz Lenart:
>>>>
>>>> Use Preparable interface instead
>>>>
>>>> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
>>>>
>>>>
>>>> Regards
>>>> --
>>>> Łukasz
>>>> http://www.lenart.org.pl/
>>>> Kapituła Javarsovia 2010
>>>> http://javarsovia.pl
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>

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



Re: Struts 2 : redirect to action method on type conversion fail ?

2010-05-10 Thread Thomas Lulé
It works.

Thanks a lot Lukasz and Alex.

2010/5/10 Alex Rodriguez Lopez :
> Hi Thomas,
>
> use the paramsPrepareParams interceptor stack (or change yours), from
> struts-default.xml:
>
> 
>            
> ...
>
> I think this accomplishes what you are looking for (of course you need
> setters for the parameters that you want params interceptor to have ready
> for you by the time the prepare() method is called).
>
> Em 10-05-2010 09:39, Thomas Lulé escreveu:
>>
>> That interceptor looks great, but is there any way to access request
>> parameters in the prepare() method ?
>>
>> The http request provides an "archiveProfileId" parameter and I use
>> that parameter to load my object "archiveProfile".
>>
>> 2010/5/10 Lukasz Lenart:
>>>
>>> Use Preparable interface instead
>>>
>>> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
>>>
>>>
>>> Regards
>>> --
>>> Łukasz
>>> http://www.lenart.org.pl/
>>> Kapituła Javarsovia 2010
>>> http://javarsovia.pl
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: Struts 2 : redirect to action method on type conversion fail ?

2010-05-10 Thread Thomas Lulé
That interceptor looks great, but is there any way to access request
parameters in the prepare() method ?

The http request provides an "archiveProfileId" parameter and I use
that parameter to load my object "archiveProfile".

2010/5/10 Lukasz Lenart :
> Use Preparable interface instead
> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
>
>
> Regards
> --
> Łukasz
> http://www.lenart.org.pl/
> Kapituła Javarsovia 2010
> http://javarsovia.pl
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Struts 2 : redirect to action method on type conversion fail ?

2010-05-10 Thread Thomas Lulé
Hi,

I've got a form with  mapped with "Long" variables in my
action class.

Also, my jsp displays some pre-computed information (that I retrieve
from database in my action's method).

When the user types letters in the number field, the type conversion
fails, and the JSP is reloaded. But the pre-computed infos are no more
displayed (because we did not execute the action's method).

I didn't find a way to redirect to the action's method even if type
conversion fails.

So I tried to store the pre-computed infos in http parameters by
adding a hidden field :


it did not work because of the "archiveProfile" thing.

I currently use a workaround, a  field that
forces struts 2 to execute the setter :
public void setDisplay(String display){
display();
}
(display() is my method which loads stuff from db.)

That works but i'm afraid of potential side-effects, do you have a better idea ?

Thanks,
Thomas

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