Thanks John. From reading the API doc, it sounds like this changes the tags
to favor
the action bean parameter over the request parameter.
It does not sound like it will change the priority of the "checked"
attribute. I'm trying to avoid writing code to populate roleId[] in a
preaction. My preaction loads the entity objects I need, but writing code to
populate roIeIds[] based on my entity objects is redundant and tedious
(certainly not a pattern I want to repeat over and over again) . I thought I
could avoid it by using the "checked" attribute, but there seems to be this
conflict between the "checked" attribute the population strategies that I
can't wrap my head around.
I will give it a try though.
On Thu, Feb 19, 2009 at 3:14 PM, Newman, John W <[email protected]> wrote:
> Try BeanFirstPopulationStrategy instead of the default, request first. I
> struggled with the checkboxes and radio button values a while ago, we
> switched to bean first which makes sense if you are using preactions to pull
> data. Since we made that switch stripes just works more like I'd expect.
> Some will argue bean first should be default, especially now since
> preactions are widely encouraged as a best practice.
>
>
>
> Can someone clear up why request first is the default?
>
>
>
>
>
> *From:* Ross Sargant [mailto:[email protected]]
> *Sent:* Thursday, February 19, 2009 2:16 PM
> *To:* Stripes Users List
> *Subject:* [Stripes-users] srtripes:checkbox checked attribute
>
>
>
> Hi,
> Can someone give me a quick explanation on the intended usage pattern for
> the stripes:checkbox checked attribute.
> I feel like I'm fighting stripes somewhat when I use it so I might be
> missing something.
>
> I'm generating a list of checkboxes to manage a many to many relationship
> in my db. I use the checked attribute to pre-check the checkboxes
> indicating the current relationships when the page first loads. A preaction
> rounds up the necessary data.
>
> <table class="sortableResults">
> <tr>
> <th></th>
> <th>Name</th>
> <th>Enabled</th>
> </tr>
> <c:forEach var="role" items="${actionBean.allRoles}">
> <tr>
> <td><stripes:checkbox name="roleIds" value="${role}"
> checked="${actionBean.systemReport.roles}"/></td>
> <td>${role.name}</td>
> <td>${role.enabled}</td>
> </tr>
> </c:forEach>
> </table>
>
>
> This works fine, but if my action bean (to which this form submits) has a
> getter for "roleIds" the checked attribute is ignored (as described in the
> pre-population priority rules).
>
> Problem:
>
> 1) I don't want to write code in my action bean to copy
> ${actionBean.systemReport.roles} into my roleIds array so I don't have a
> getter for roleIds. This makes the checked attribute work.
>
> 2) Without the getter present. When no checkboxes are checked, stripes
> nulls out the roleIds field in my action bean using the setter. By
> default, I initialize it to an empty array. I want to work with the empty
> array and not a null array if no checkboxes are checked.
>
> I can obviously work-around either of these issues but the workarounds are
> kludgy. I thought there might be something fundamentally wrong with the
> approach I'm taking here..
>
> --
> Ross Sargant
>
> TVR Communications LLC
> Software Engineer
> 3275 W Hillsboro Blvd,Suite 300,Deerfield Beach, Florida,33442
>
> http://www.tvrc.com
>
> p: 954-571-2017 x2108
>
> email: [email protected]
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Ross Sargant
TVR Communications LLC
Software Engineer
3275 W Hillsboro Blvd,Suite 300,Deerfield Beach, Florida,33442
http://www.tvrc.com
p: 954-571-2017 x2108
email: [email protected]
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users