Scott Van Wart-2 wrote:
> 
> Jonathan wrote:
>> Edit/Create Meeting.jsp select and options-collection tags
>> ----------------------------------------------------------
>> <stripes:select name="meeting.attendedBy.id"
>> value="meeting.attendeedBy.id" 
>> multiple="true" size="5">
>>   <stripes:option value="">--Select Attendeed By--</stripes:option>
>>   <stripes:options-collection collection="${actionBean.allPeople}"
>> value="id" 
>> label="name"/>
>> </stripes:select>
>>   
> Stripes needs a list of currently-selected IDs (even if it's empty):
> 
> In meeting:
>     private Set<Long> attendedByIds; // + getter/setter
> 
> Then your select:
>   <stripes:select name="meeting.attendedByIds" multiple="true" size="5">
>     <stripes:option value="">--Select Attended By--</stripes:option>
>     <stripes:options-collection collection="${actionBean.allPeople}" 
> value="id" label="name" />
>   </stripes:select>
> 
> Stripes populates the list with the "allPeople" property.  It figures 
> out which one to pre-select when it renders the select by 
> "meeting.attendedByIds".  When the user submits the form, it fills up 
> "meeting.attendedByIds" with the ids of all the people the user 
> selected.  I think you simply mixed up your inputs and outputs.
> 
> HTH,
>   Scott
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
> 
> 

hi


I have been facing problem in assigning the value to the list property here
is the code


here i am having Roles set 

public class Person implements Serializable {

        private static final long serialVersionUID = 1L;

        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private int id;

        @Column
        private String username;
        private String firstName;
        private String lastName;
        private String email;
        private String password;
        private String phone;

        /** Default constructor. */
        public Person() {
        }

        
        private Set<Roles> roles;

        public Set<Roles> getRoles() {
                return roles;
        }

        public void setRoles(Set<Roles> roles) {
                this.roles = roles;
        }
        
}

this is my action bean

public class RegisterActionBean extends BaseActionBean {

 private Person user;

 public Person getUser () {
                return user;
        }

        public void setUser (Person user) {
                this.user= user;
        }
Set<Roles>rolesavilable=new HashSet<Roles>();
        
        
        public Set<Roles> getRolesavilable() {
                return rolesavilable;
        }

        public void setRolesavilable(Set<Roles> rolesavilable) {
                this.rolesavilable = rolesavilable;
        }

@DefaultHandler
        public Resolution view() {
                rolesavilable=new HashSet<Roles>(roleservice.findAll());
                return new ForwardResolution("pages/Register.jsp");
        }
@HandlesEvent("save")
        public Resolution save() {

                
                System.out.println(user.getFirstName());
                System.out.println("test for 
role+++++++++++++++"+user.getRoles());
                
                service.saveUser(user);
                System.out.println("registered sussefuly");
                return new ForwardResolution("/index.jsp");
        }
}


here the i get the user name but i get null for Roles

this my jsp page

<table class="leftRightForm">
                                <tr>
                                        <th><stripes:label for="user.firstName" 
/>:</th>
                                        <td><stripes:text name="user.firstName" 
/> <stripes:errors
                                                        field="user.firstName" 
/></td>
                                </tr>

<tr>

                                        <th><stripes:label for="user.roles" 
/>:</th>
                                        <td><stripes:select name="user.roles" >
                                                        <stripes:option 
value="">--Roles--</stripes:option>
                                                        
<stripes:options-collection
                                                                
collection="${actionBean.rolesavilable}" value="role_id"
                                                                label="ROLES" />
                                                </stripes:select> </td>
                                </tr>
</table>

"rolesavilable " of type Set<Roles> i get this from default handler but it
is not getting assigned to user.roles 

where roles is set of type<Roles>



-- 
View this message in context: 
http://old.nabble.com/Confusion-with-Stripes-Multiple-Select-Options-and-Nested-Collections-tp17090307p34305757.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to