I have two classes User and Role.User class has Role as one of its attributes
and getRole() and setRole() methods. Role class 

has two attributes name and description.

I have a form to add user with drop down choice which has list of role
names. When I submit the form, I need to add this form 

value role name to user database. But at present it is showing null pointer
exception. How do I convert this String value 

(role name ) to Role object. My code is as below. 

        ........
        ........
        TextField userNameComp = new TextField("username");
        ............
        ...........
        ..........
        
        DropDownChoice ddc = new DropDownChoice("role",roleList);
        form.add(userNameComp);
        ...........
        .........
        ..........
        form.add(ddc);
    }
    
    class userAddForm extends Form {
        public userAddForm(String id,IModel model) {
            super(id,model);
        }
        @Override
        public void onSubmit() {
            User ad = (User)getModelObject();
          ..........
                ad.add();  // class User has add() method which adds the
values of the UserAddForm to database
        .........
        .........
        }
    }
}      


Please help.
thanks
-- 
View this message in context: 
http://www.nabble.com/Convert-String-to-desired-class-object-tf4848185.html#a13871390
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to