You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Philippe Steinmetz <st...@ISI.EDU> on 2007/09/05 22:36:16 UTC

Input Validation example

Hello all,

 

I'm having some trouble with the input validation example. I have everything
set up as described in

 

http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html

 

but am getting the following error for my Login page:

 

Parameter(s) translate, value are required for
org.apache.tapestry.corelib.components.TextField, but have not been bound.

 

Anyone know why? I'm using Tap 5.0.5

 

Jean-Philippe Steinmetz

-----------------------------------

Webmaster / Developer

Information Sciences Institute

University of Southern California

steinmet@isi.edu

310.448.8471

 


Re: Input Validation example

Posted by Nick Westgate <ni...@key-planning.co.jp>.
> [ERROR] Login Embedded component(s) form are defined within component class
> edu.usc.k12.cpanel.pages.Login, but are not present in the component
> template.

Yeah, there is a small bug in the template error reporting.

<t:form> is a component of type "Form" that is assigned a default id,
and that's the same as the type name "form". This matches Form _form.

To get rid of the error use:
<t:form t:id="form">

You could use a better name than form though, like loginForm. ;-)
<t:form t:id="loginForm">

(Sorry I didn't post that earlier - I've been busy, and sick.)

> if(!userExists) return new Login();
>
> From what I gather this is the correct way to send a class? Anyhow, it
> doesn't work so instead I put
> 
> if(!userExists) return "Login";

The valid return types are described here, though examples would be better:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html

new Login() is a POJO which Tapestry doesn't know what to do with.
Login.class is what you are looking for to allow safe refactoring.

> Which seems to work fine, except it won't work on the Start page. For some
> reason that page just serves up an empty page. However, it could be
> something else I haven't figured out yet, like this problem with the other
> items. If you have any thoughts on these weird inconsistencies it'd be
> helpful. Thanks.

Yes, there is also a bug in redirection from the root URL.
You've done well to find these 2 bugs in such a short time. ;-)

If you really need to, you can patch bug #2 at runtime until it's fixed:
http://wiki.apache.org/tapestry/Tapestry5RootPathEmptyResponse
(A simple introduction to the power of tapestry-ioc.)

Cheers,
Nick.

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


Re: Input Validation example

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
if(!userExists) return new Login();

This probably doesn't work because returning a page instance usually 
assumes it being injected via @InjectPage.

Jean-Philippe Steinmetz skrev:
> Yea I've double checked the code a few times. For whatever reason I can get
> the form to show up now but I'm still seeing the following message in the
> tomcat stdout log.
> 
> [ERROR] Login Embedded component(s) form are defined within component class
> edu.usc.k12.cpanel.pages.Login, but are not present in the component
> template.
> 
> So it would appear to be working. As I've discovered other little quirks
> here and there it seems to have solved this problem. I'm really not sure why
> Tapestry would've given me these errors if it was a problem with something
> else in my code.
> 
> For instance I had a problem where one of my context resources wasn't being
> loaded because I didn't have the .jar file in Tomcat's lib directory. That's
> solved now.
> 
> Here's another interesting quirk I've discovered. I do a page redirection
> from onActivate as a security check. So if the user hasn't logged in, they
> get sent to the login page. To do that I have
> 
> if(!userExists) return new Login();
> 
>>>From what I gather this is the correct way to send a class? Anyhow, it
> doesn't work so instead I put
> 
> if(!userExists) return "Login";
> 
> Which seems to work fine, except it won't work on the Start page. For some
> reason that page just serves up an empty page. However, it could be
> something else I haven't figured out yet, like this problem with the other
> items. If you have any thoughts on these weird inconsistencies it'd be
> helpful. Thanks.
> 
> Jean-Philippe
> 
>> -----Original Message-----
>> From: Nick Westgate [mailto:nick@key-planning.co.jp]
>> Sent: Thursday, September 06, 2007 9:31 PM
>> To: Tapestry users
>> Subject: Re: Input Validation example
>>
>> Are you sure you've copied the source exactly?
>>
>> It's telling you that it can't match components with those id's to
>> component fields in the Java class.
>>
>> So
>>      <input t:type="PasswordField" t:id="password"
>> t:validate="required,minlength=3" size="30"/>
>> ...
>>      @Component(id = "password")
>>      private PasswordField _passwordField;
>>
>> Cheers,
>> Nick.
>>
>>
>> Jean-Philippe Steinmetz wrote:
>>> Well that problem seems to have been solved. Now I'm getting the message
>>>
>>> Component Login does not contain an embedded component with id 'form'.
>>>
>>> And
>>>
>>> Component Login does not contain an embedded component with id
>> 'password'.
>>> Jean-Philippe
>>>
>>>> -----Original Message-----
>>>> From: Nick Westgate [mailto:nick@key-planning.co.jp]
>>>> Sent: Wednesday, September 05, 2007 8:13 PM
>>>> To: Tapestry users
>>>> Subject: Re: Input Validation example
>>>>
>>>> This should work automatically. Read the component reference for
>>>> TextField.
>>>> Your java class should define a property with the same name as the
>> field's
>>>> id.
>>>>
>>>> (It's already there if you copied the source.)
>>>>
>>>> Cheers,
>>>> Nick.
>>>>
>>>>
>>>> Jean-Philippe Steinmetz wrote:
>>>>> Hello all,
>>>>>
>>>>>
>>>>>
>>>>> I'm having some trouble with the input validation example. I have
>>>> everything
>>>>> set up as described in
>>>>>
>>>>>
>>>>>
>>>>> http://tapestry.apache.org/tapestry5/tapestry-
>> core/guide/validation.html
>>>>>
>>>>>
>>>>> but am getting the following error for my Login page:
>>>>>
>>>>>
>>>>>
>>>>> Parameter(s) translate, value are required for
>>>>> org.apache.tapestry.corelib.components.TextField, but have not been
>>>> bound.
>>>>>
>>>>> Anyone know why? I'm using Tap 5.0.5
>>>>>
>>>>>
>>>>>
>>>>> Jean-Philippe Steinmetz
>>>>>
>>>>> -----------------------------------
>>>>>
>>>>> Webmaster / Developer
>>>>>
>>>>> Information Sciences Institute
>>>>>
>>>>> University of Southern California
>>>>>
>>>>> steinmet@isi.edu
>>>>>
>>>>> 310.448.8471
>>>>>
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


RE: Input Validation example

Posted by Jean-Philippe Steinmetz <st...@ISI.EDU>.
Yea I've double checked the code a few times. For whatever reason I can get
the form to show up now but I'm still seeing the following message in the
tomcat stdout log.

[ERROR] Login Embedded component(s) form are defined within component class
edu.usc.k12.cpanel.pages.Login, but are not present in the component
template.

So it would appear to be working. As I've discovered other little quirks
here and there it seems to have solved this problem. I'm really not sure why
Tapestry would've given me these errors if it was a problem with something
else in my code.

For instance I had a problem where one of my context resources wasn't being
loaded because I didn't have the .jar file in Tomcat's lib directory. That's
solved now.

Here's another interesting quirk I've discovered. I do a page redirection
from onActivate as a security check. So if the user hasn't logged in, they
get sent to the login page. To do that I have

if(!userExists) return new Login();

>From what I gather this is the correct way to send a class? Anyhow, it
doesn't work so instead I put

if(!userExists) return "Login";

Which seems to work fine, except it won't work on the Start page. For some
reason that page just serves up an empty page. However, it could be
something else I haven't figured out yet, like this problem with the other
items. If you have any thoughts on these weird inconsistencies it'd be
helpful. Thanks.

Jean-Philippe

> -----Original Message-----
> From: Nick Westgate [mailto:nick@key-planning.co.jp]
> Sent: Thursday, September 06, 2007 9:31 PM
> To: Tapestry users
> Subject: Re: Input Validation example
> 
> Are you sure you've copied the source exactly?
> 
> It's telling you that it can't match components with those id's to
> component fields in the Java class.
> 
> So
>      <input t:type="PasswordField" t:id="password"
> t:validate="required,minlength=3" size="30"/>
> ...
>      @Component(id = "password")
>      private PasswordField _passwordField;
> 
> Cheers,
> Nick.
> 
> 
> Jean-Philippe Steinmetz wrote:
> > Well that problem seems to have been solved. Now I'm getting the message
> >
> > Component Login does not contain an embedded component with id 'form'.
> >
> > And
> >
> > Component Login does not contain an embedded component with id
> 'password'.
> >
> > Jean-Philippe
> >
> >> -----Original Message-----
> >> From: Nick Westgate [mailto:nick@key-planning.co.jp]
> >> Sent: Wednesday, September 05, 2007 8:13 PM
> >> To: Tapestry users
> >> Subject: Re: Input Validation example
> >>
> >> This should work automatically. Read the component reference for
> >> TextField.
> >> Your java class should define a property with the same name as the
> field's
> >> id.
> >>
> >> (It's already there if you copied the source.)
> >>
> >> Cheers,
> >> Nick.
> >>
> >>
> >> Jean-Philippe Steinmetz wrote:
> >>> Hello all,
> >>>
> >>>
> >>>
> >>> I'm having some trouble with the input validation example. I have
> >> everything
> >>> set up as described in
> >>>
> >>>
> >>>
> >>> http://tapestry.apache.org/tapestry5/tapestry-
> core/guide/validation.html
> >>>
> >>>
> >>>
> >>> but am getting the following error for my Login page:
> >>>
> >>>
> >>>
> >>> Parameter(s) translate, value are required for
> >>> org.apache.tapestry.corelib.components.TextField, but have not been
> >> bound.
> >>>
> >>>
> >>> Anyone know why? I'm using Tap 5.0.5
> >>>
> >>>
> >>>
> >>> Jean-Philippe Steinmetz
> >>>
> >>> -----------------------------------
> >>>
> >>> Webmaster / Developer
> >>>
> >>> Information Sciences Institute
> >>>
> >>> University of Southern California
> >>>
> >>> steinmet@isi.edu
> >>>
> >>> 310.448.8471
> >>>
> >>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org




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


Re: Input Validation example

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Are you sure you've copied the source exactly?

It's telling you that it can't match components with those id's to
component fields in the Java class.

So
     <input t:type="PasswordField" t:id="password" t:validate="required,minlength=3" size="30"/>
...
     @Component(id = "password")
     private PasswordField _passwordField;

Cheers,
Nick.


Jean-Philippe Steinmetz wrote:
> Well that problem seems to have been solved. Now I'm getting the message
> 
> Component Login does not contain an embedded component with id 'form'.
> 
> And 
> 
> Component Login does not contain an embedded component with id 'password'.
> 
> Jean-Philippe
> 
>> -----Original Message-----
>> From: Nick Westgate [mailto:nick@key-planning.co.jp]
>> Sent: Wednesday, September 05, 2007 8:13 PM
>> To: Tapestry users
>> Subject: Re: Input Validation example
>>
>> This should work automatically. Read the component reference for
>> TextField.
>> Your java class should define a property with the same name as the field's
>> id.
>>
>> (It's already there if you copied the source.)
>>
>> Cheers,
>> Nick.
>>
>>
>> Jean-Philippe Steinmetz wrote:
>>> Hello all,
>>>
>>>
>>>
>>> I'm having some trouble with the input validation example. I have
>> everything
>>> set up as described in
>>>
>>>
>>>
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
>>>
>>>
>>>
>>> but am getting the following error for my Login page:
>>>
>>>
>>>
>>> Parameter(s) translate, value are required for
>>> org.apache.tapestry.corelib.components.TextField, but have not been
>> bound.
>>>
>>>
>>> Anyone know why? I'm using Tap 5.0.5
>>>
>>>
>>>
>>> Jean-Philippe Steinmetz
>>>
>>> -----------------------------------
>>>
>>> Webmaster / Developer
>>>
>>> Information Sciences Institute
>>>
>>> University of Southern California
>>>
>>> steinmet@isi.edu
>>>
>>> 310.448.8471
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


RE: Input Validation example

Posted by Jean-Philippe Steinmetz <st...@ISI.EDU>.
Well that problem seems to have been solved. Now I'm getting the message

Component Login does not contain an embedded component with id 'form'.

And 

Component Login does not contain an embedded component with id 'password'.

Jean-Philippe

> -----Original Message-----
> From: Nick Westgate [mailto:nick@key-planning.co.jp]
> Sent: Wednesday, September 05, 2007 8:13 PM
> To: Tapestry users
> Subject: Re: Input Validation example
> 
> This should work automatically. Read the component reference for
> TextField.
> Your java class should define a property with the same name as the field's
> id.
> 
> (It's already there if you copied the source.)
> 
> Cheers,
> Nick.
> 
> 
> Jean-Philippe Steinmetz wrote:
> > Hello all,
> >
> >
> >
> > I'm having some trouble with the input validation example. I have
> everything
> > set up as described in
> >
> >
> >
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
> >
> >
> >
> > but am getting the following error for my Login page:
> >
> >
> >
> > Parameter(s) translate, value are required for
> > org.apache.tapestry.corelib.components.TextField, but have not been
> bound.
> >
> >
> >
> > Anyone know why? I'm using Tap 5.0.5
> >
> >
> >
> > Jean-Philippe Steinmetz
> >
> > -----------------------------------
> >
> > Webmaster / Developer
> >
> > Information Sciences Institute
> >
> > University of Southern California
> >
> > steinmet@isi.edu
> >
> > 310.448.8471
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org




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


Re: Input Validation example

Posted by Nick Westgate <ni...@key-planning.co.jp>.
This should work automatically. Read the component reference for TextField.
Your java class should define a property with the same name as the field's id.

(It's already there if you copied the source.)

Cheers,
Nick.


Jean-Philippe Steinmetz wrote:
> Hello all,
> 
>  
> 
> I'm having some trouble with the input validation example. I have everything
> set up as described in
> 
>  
> 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
> 
>  
> 
> but am getting the following error for my Login page:
> 
>  
> 
> Parameter(s) translate, value are required for
> org.apache.tapestry.corelib.components.TextField, but have not been bound.
> 
>  
> 
> Anyone know why? I'm using Tap 5.0.5
> 
>  
> 
> Jean-Philippe Steinmetz
> 
> -----------------------------------
> 
> Webmaster / Developer
> 
> Information Sciences Institute
> 
> University of Southern California
> 
> steinmet@isi.edu
> 
> 310.448.8471
> 
>  
> 
> 

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