1) No valuemap is a cheap model, the only value is using it in this cause is
that it's quick to write, see models for more information.

2) That example is designed to show you how to do sign in, not necessary the
best way to handle getting data from forms.  From looking at the code you
highlight I'd say it's duplicative.

Jeremy

On Thu, Feb 19, 2009 at 12:47 AM, Matt Welch <[email protected]> wrote:

>
> I don't know if these are actually SignInPanel (from wicket-auth-roles)
> questions or if they're in fact more general "wicket" questions; probably
> the latter, but the SignInPanel class is where I noticed these things.
>
> 1) In the SignInPanel I notice that instead of having a couple of private
> String variables to represent the username and password, a ValueMap is used
> instead. I'm curious as to why.  Is there some benefit to using a ValueMap?
>
> 2) When the values that are typed in the username and password fields are
> needed to pass to the signIn() method, they are retrieved in ways that I
> would not have normally considered. The username value is retrieved with
> the
> getDefaultModelObjectAsString() method of the username's TextField
> component
> and the password is retrieved with the getInput() method of the password's
> PasswordTextField component. Why are the values retrieved this way? I
> assume
> there's a good reason, but because I don't understand it, I'm a bit unsure
> as to where in my own application I should be using the same techniques.
>
> My first instinct for a panel like this would have been to add two String
> variables to the class to act as the model for the username and password
> TextFields and then to access those values with normal getter methods. I'd
> would find it quite instructive to know why these other approaches were
> used
> instead so that I can take similar actions in my own application.
>
> Thanks!
>
> I'll include some snippets from the SignInPanel class below so that it
> doesn't have to be looked up:
>
>
> -------------
>        private final ValueMap properties = new ValueMap();
> -------------
>        add(username = new TextField<String>("username", new
> PropertyModel<String>(properties,
>                                "username")));
>        add(password = new PasswordTextField("password", new
> PropertyModel<String>(properties,
>                                "password")));
> -------------
>        public String getPassword()
>        {
>                return password.getInput();
>        }
> -------------
>        public String getUsername()
>        {
>                return username.getDefaultModelObjectAsString();
>        }
> -------------
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Some-SignInPanel-Questions-tp22094376p22094376.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Jeremy Levy

See my location in real-time:
http://seemywhere.com/jeremy

Reply via email to