You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Nedrow <dn...@mac.com> on 2008/06/13 00:04:29 UTC

PasswordTextField model?

Given the following from the wicket security quickstart (1.3- 
SNAPSHOT)...

add(new PasswordTextField("password").setOutputMarkupId(false));

glassfish generates the following message....

Couldn't resolve model type of  
Model:classname=[org.apache.wicket.model.CompoundPropertyModel 
$ 
AttachedCompoundPropertyModel 
]:nestedModel 
= 
[Model:classname 
=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[username  
= "regular"]] for [MarkupContainer [Component id = password, page =  
com.vzbi.ncs.argfrp.webapp.FilterRequest.app.LoginPage, path =  
0:signInPanel:signInForm:password.PasswordTextField, isVisible = true,  
isVersioned = false]], please set the type yourself.

Not setting the model does not seem to create a problem, but it would  
seem that the system would prefer that models be set where applicable.

Is that the case? I have to admit, I'm a little anal about clearing  
all warnings in my apps.

What would an appropriate model be for the above PasswordTextField()?

Models seem to be the most poorly "exampled" Wicket feature, in that  
examples of Models rarely tell one why they are needed and what role  
they perform. It's generally, here's an example to make your code  
work. Clearly, in most cases the model contains the data for the  
markup. But what would that data be for a PasswordTextField()? One  
isn't normally going to pre-fill a password field, correct?

Thanks,

David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PasswordTextField model?

Posted by Maurice Marrink <ma...@gmail.com>.
Actually the example does set a model for the password field. As shown
in this snippet.

//Set compound model on the form, inputfields will use that model too.
super(id, new CompoundPropertyModel(new ValueMap()));
// only remember username, not passwords
add(new TextField("username").setPersistent(rememberMe).setOutputMarkupId(false));
add(new PasswordTextField("password").setOutputMarkupId(false));
add(new CheckBox("rememberMe", new PropertyModel(this, "rememberMe")));

I added an extra comment to show this more clearly :).

As for the message you are receiving when running from glasshfish, i
don't know why you are getting that, i don't remember seeing it when
running from tomcat. but as stated you could try
 add(new PasswordTextField("password").setType(String.class).setOutputMarkupId(false));

Maurice

On Fri, Jun 13, 2008 at 2:07 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> no, you dont typically initialize the field. but you do want to
> retrieve the result right? so you need to give the field a model.
> wicket might not call model.getobject() on it, but it will call
> model.setobject() when the form is submitted.
>
> models do not contain data for markup, but for components.
>
> -igor
>
> On Thu, Jun 12, 2008 at 3:04 PM, David Nedrow <dn...@mac.com> wrote:
>> Given the following from the wicket security quickstart (1.3-SNAPSHOT)...
>>
>> add(new PasswordTextField("password").setOutputMarkupId(false));
>>
>> glassfish generates the following message....
>>
>> Couldn't resolve model type of
>> Model:classname=[org.apache.wicket.model.CompoundPropertyModel$AttachedCompoundPropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[username
>> = "regular"]] for [MarkupContainer [Component id = password, page =
>> com.vzbi.ncs.argfrp.webapp.FilterRequest.app.LoginPage, path =
>> 0:signInPanel:signInForm:password.PasswordTextField, isVisible = true,
>> isVersioned = false]], please set the type yourself.
>>
>> Not setting the model does not seem to create a problem, but it would seem
>> that the system would prefer that models be set where applicable.
>>
>> Is that the case? I have to admit, I'm a little anal about clearing all
>> warnings in my apps.
>>
>> What would an appropriate model be for the above PasswordTextField()?
>>
>> Models seem to be the most poorly "exampled" Wicket feature, in that
>> examples of Models rarely tell one why they are needed and what role they
>> perform. It's generally, here's an example to make your code work. Clearly,
>> in most cases the model contains the data for the markup. But what would
>> that data be for a PasswordTextField()? One isn't normally going to pre-fill
>> a password field, correct?
>>
>> Thanks,
>>
>> David
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PasswordTextField model?

Posted by Igor Vaynberg <ig...@gmail.com>.
no, you dont typically initialize the field. but you do want to
retrieve the result right? so you need to give the field a model.
wicket might not call model.getobject() on it, but it will call
model.setobject() when the form is submitted.

models do not contain data for markup, but for components.

-igor

On Thu, Jun 12, 2008 at 3:04 PM, David Nedrow <dn...@mac.com> wrote:
> Given the following from the wicket security quickstart (1.3-SNAPSHOT)...
>
> add(new PasswordTextField("password").setOutputMarkupId(false));
>
> glassfish generates the following message....
>
> Couldn't resolve model type of
> Model:classname=[org.apache.wicket.model.CompoundPropertyModel$AttachedCompoundPropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[username
> = "regular"]] for [MarkupContainer [Component id = password, page =
> com.vzbi.ncs.argfrp.webapp.FilterRequest.app.LoginPage, path =
> 0:signInPanel:signInForm:password.PasswordTextField, isVisible = true,
> isVersioned = false]], please set the type yourself.
>
> Not setting the model does not seem to create a problem, but it would seem
> that the system would prefer that models be set where applicable.
>
> Is that the case? I have to admit, I'm a little anal about clearing all
> warnings in my apps.
>
> What would an appropriate model be for the above PasswordTextField()?
>
> Models seem to be the most poorly "exampled" Wicket feature, in that
> examples of Models rarely tell one why they are needed and what role they
> perform. It's generally, here's an example to make your code work. Clearly,
> in most cases the model contains the data for the markup. But what would
> that data be for a PasswordTextField()? One isn't normally going to pre-fill
> a password field, correct?
>
> Thanks,
>
> David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PasswordTextField model?

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Thu, 12 Jun 2008, David Nedrow wrote:
> Couldn't resolve model type of  
> Model:classname=[org.apache.wicket.model.CompoundPropertyModel 
> $ 
> AttachedCompoundPropertyModel 
> ]:nestedModel 
> = 
> [Model:classname 
> =[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[username  
> = "regular"]] for [MarkupContainer [Component id = password, page =  
> com.vzbi.ncs.argfrp.webapp.FilterRequest.app.LoginPage, path =  
> 0:signInPanel:signInForm:password.PasswordTextField, isVisible = true,  
> isVersioned = false]], please set the type yourself.
> 
> Not setting the model does not seem to create a problem, but it would  
> seem that the system would prefer that models be set where applicable.

I think that the problem is not actually the lack of model, 
but that Wicket cannot figure out to what type of object the
model of the formcomponent is supposed to contain. 

Calling passwordField.setType(TypeOfMyPasswordObject.class)
might help. The type can also be supplied in the constructor.

> Is that the case? I have to admit, I'm a little anal about clearing  
> all warnings in my apps.

I know the feeling :)

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org