where does the TextField and the DDC store their values? I don't see models
attached to them.
Read all about models here: Working with Wicket
models<http://cwiki.apache.org/WICKET/working-with-wicket-models.html>
Martijn
On Nov 21, 2007 6:37 AM, tsuresh <[EMAIL PROTECTED]> wrote:
>
> 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]
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/