Page 4 of 4 FirstFirst ... 234
Results 31 to 35 of 35

Thread: How to create and use checkbox list

  1. #31
    Join Date
    Oct 2005
    Location
    Amsterdam
    Posts
    81

    Default

    Now I can answer. They aren't. I guess that this is because I'm using java.util.Set. Maybe I should use an indexed Collection?

  2. #32
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    Quote Originally Posted by NicolasPeeters
    Now I can answer. They aren't. I guess that this is because I'm using java.util.Set. Maybe I should use an indexed Collection?
    Well, an ordered Set would certainly be a good start

    The other reason is that you are checking the ${status.value} which is the entire Set, which in turn calls getAsText() which (as previously discussed) returns null

    What I tend to do (as described in my original FAQ post) is create a map in reference data which contains all possible selections, the key is the object (Customer) and the value is a boolean to indicate whether it should be preselected.

  3. #33
    Join Date
    Nov 2007
    Posts
    19

    Default

    Hi,

    Can i have a war file for this???

  4. #34
    Join Date
    Jul 2005
    Location
    PA
    Posts
    11

    Default Upgrade to Spring 2.5.0

    There is now as of Spring 2.5.0 a very simple way to handle collections of checkboxes and radiobuttons.

    in Spring 2.0.7 you can't do

    <c:forEach var="interest" items="${interests}">
    <frm:checkbox path="interests" value="${interest}" />
    <c: out value="${interest.name}" />
    </c:forEach>

    where items="${interests}" is the complete Set of things people may be interested in and path="interests" is the Set of things a given person is interested in. The reason, I think, has to do with this post: http://opensource.atlassian.com/proj...rowse/SPR-3704.

    Thankfully this has been fixed in Spring 2.5.0 and in addition there is a new shorthand method (mentioned in this post: http://opensource.atlassian.com/proj...rowse/SPR-3882:

    <frm:checkboxes path="interests" items="${interests}" itemLabel="name"/>

    Things to note:

    1. Make sure your object has a proper equals() method or it won't work.

    This is one of those issues I'm glad I spent time trying to figure out because none of the alternatives were very good.

    http://blog.jsks.us/index.php/2007/1...his-a-victory/
    Always Learning

  5. #35
    wonka Guest

    Default

    Quote Originally Posted by johndstein View Post
    There is now as of Spring 2.5.0 a very simple way to handle collections of checkboxes and radiobuttons.

    in Spring 2.0.7 you can't do

    <c:forEach var="interest" items="${interests}">
    <frm:checkbox path="interests" value="${interest}" />
    <c: out value="${interest.name}" />
    </c:forEach>

    where items="${interests}" is the complete Set of things people may be interested in and path="interests" is the Set of things a given person is interested in. The reason, I think, has to do with this post: http://opensource.atlassian.com/proj...rowse/SPR-3704.

    Thankfully this has been fixed in Spring 2.5.0 and in addition there is a new shorthand method (mentioned in this post: http://opensource.atlassian.com/proj...rowse/SPR-3882:

    <frm:checkboxes path="interests" items="${interests}" itemLabel="name"/>

    Things to note:

    1. Make sure your object has a proper equals() method or it won't work.

    This is one of those issues I'm glad I spent time trying to figure out because none of the alternatives were very good.

    http://blog.jsks.us/index.php/2007/1...his-a-victory/
    thanks.. had some problems with that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •