Form inputs are populated by the PopulationStrategy.
DefaultPopulationStrategy, which you are probably using right now, populates
an input's value first from a request parameter having the same name as the
input, if any, then from the (nested) property of the form's ActionBean, and
finally from the "value" attribute.
You can change to BeanFirstPopulationStrategy to reverse the first two. That
is, the value will be pulled first from the ActionBean property then from
the request parameter then from the "value" attribute. To switch the whole
application to bean-first, add the following to your StripesFilter
configuration:
<init-param>
<param-name>PopulationStrategy.Class</param-name>
<param-value>net.sourceforge.stripes.tag.BeanFirstPopulationStrategy</param-value>
</init-param>
In my opinion, the default strategy is the better one. Bean-first can be
useful sometimes, as in this case. Ideally, one would be able to switch
between the two as needed. Such a strategy is described here
http://www.stripesframework.org/display/stripes/Overriding+PopulationStrategy+per+ActionBean
-Ben
On Sat, Jan 22, 2011 at 2:54 AM, andres <ispanand...@yahoo.es> wrote:
> Hello everyone.
>
> I have a question about Stripes form.
> I want to change hidden value in the form from action, but Stripes do not
> want to do it.
>
> My form
>
> action="/Test/newSearch" <s:form method="post">
>
> name="item" <s:hidden value="${item}"/>
> name="item.filterText" <s:text value="${actionBean.item.filterText}"> </ s:
> text>
>
> <! - not does change the value (my problem here) ->
> name="item.filterPageIndex" <s:hidden
> value="${actionBean.item.filterPageIndex}" id="filterPageIndex"> </ s:
> hidden>
>
> <! - value was changed and Can Be viewed with c: out ->
> <c:out value="${actionBean.item.filterPageIndex}"> </ c: out>
>
> class="buttons" <s:submit title="Search" name="" value="Search"/>
> </ s: form>
>
> ActionBean
> .....
>
> ItemVO private item;
> ItemVO public getItem () {
> return item;
> }
> public void setItem (ItemVO item) {
> this.item = item;
> }
>
> Resolution newSearch public () {
>
> / / print form input values
> log.debug ("filterText text" + getItem (). getFilterText ());
> log.debug ("filterPageIndex value" + getItem (). getFilterPageIndex ());
>
> / / change form hidden value (I want to change hidden value)
> getItem().setFilterPageIndex (1);
>
> return new ForwardResolution ("/ jsp / test.jsp");
> }
>
> ....
>
> Value received from action was changed, my question is why Stripes did not
> change hidden field? I've done something wrong?
>
> Thank you very much.
>
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
> price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users