As an additional information, Stripes uses the value of a tag only if it cannot 
find a suitable value in your action bean. Since the lidNumber property has a 
value of 0, it is considered suitable and value is ignored.
The best way to initialize properties of an ActionBean is with a method 
annotated with @Before(stages=LifecycleStage.BindingAndValidation).

As others suggested, your best option for your specific question is to subclass 
ActionBeanContext to have a getLidNumber() method in it that returns the value 
from session.
You can also use 
context.getRequest().getsession().getAttribute("lid").getLidNumber() instead.

Christian

-----Message d'origine-----
De : Iwao AVE [mailto:haraw...@gmail.com] 
Envoyé : October-04-11 7:35 AM
À : Stripes Users List
Objet : Re: [Stripes-users] s:hidden value transfer issue

Hi Enrico,

It's better to use the plain html tag in this case:
<input type="hidden" name="lidNummer" value="${sessionScope.lid.lidNummer}" />

Stripes' hidden tag is necessary only when you need its complex value
(re)population mechanism managed by the population strategy.

# ...and you should consider subclassing ActionBeanContext as Rolf suggested.

Regards,
Iwao

2011/10/4 Enrico Iorio <writetoenr...@gmail.com>:
> Dears
>
> I have some very strange problem with sending an integer value to an
> ActionBean from a jsp via a <s:hidden> tag.
> Basically i have a bean called Lid which represents an user and that after
> log-in is stored in the session (successfully), this bean has an attribute
> "lidNummer" and its respective getter-setter.
>
> In the action bean that uses the Lid object, i have the setter to assign a
> value coming from a form, i dont use a direct-feeding (e.g lid.lidNummer),
> so i have (in action bean):
> --------------////
>
> private int lidNummer=0;
>
> public void setLidNummer(int lidNummer){
>
> this.lidNummer=lidNummer;
>
> }
>
> -----------////
>
> this is the hidden tag that i have in the jsp and that "should" feed the
> attribute with its setter:
>
> --------------////
>
> <s:form beanclass="path.to.ActionBean">
>
> <s:hidden name="lidNummer" value="${sessionScope.lid.lidNummer}"/>
>
>  //rest of form "form works fine"
>
> --------------////
>
> The problem is that the value sent from the <s:hidden> tag is 0 when it
> should be different "should be the number of the user which is logged in"
>
> The "funny thing" is that if i add to the jsp this piece of JSTL:
>
> --------------////
>
> <s:form beanclass="path.to.ActionBean">
>
> <c:out value="${sessionScope.lid.lidNummer}"/>
>
> <s:hidden name="lidNummer" value="${sessionScope.lid.lidNummer}"/>
>
>  --------------////
>
> The out method prints the correct value of the lidNummer value.
> It's like Stripes cannot access the lid object into the session, very
> strange.
> Do you have some idea?
>
> --
> Enrico Iorio

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to