Hi, in your Java class you have @Component private Form form; and in template: <form t:type="form" t:id="loginForm">
If you don't provide a component id is argument to @Component, Tapestry uses field's name as the id. You need to do one of following: - change field name to loginForm, - or add "loginForm" as argument to @Component. - or change t:id in your template to "form" In this case I would also recommend to use @InjectComponent instead of @Component, e.g.: @InjectComponent("loginForm") private Form form; Best regards Cezary On Tue, Oct 23, 2012 at 7:40 PM, John <j...@quivinco.com> wrote: > I did a T4 project ages ago and now learning T5. > > I just want to build a working login page and copied the code snippets > here http://tapestry.apache.org/forms-and-validation.html and added them > to the quickstart application - my versions appear below. > > When I navigate to the Login page it returns: > Embedded component(s) form are defined within component class > com.epulse.tapestrydemo.pages.Login (or a super-class of Login), but are > not present in the component template > (classpath:com/epulse/tapestrydemo/pages/Login.tml). > > Has anyone a simple login page example that works, or can help with the > above? > > John > > > > /* > * To change this template, choose Tools | Templates > * and open the template in the editor. > */ > package com.epulse.tapestrydemo.pages; > > import com.epulse.tapestrydemo.security.UserAuthenticator; > import org.apache.tapestry5.annotations.Component; > import org.apache.tapestry5.annotations.InjectComponent; > import org.apache.tapestry5.annotations.Persist; > import org.apache.tapestry5.annotations.Property; > import org.apache.tapestry5.corelib.components.Form; > import org.apache.tapestry5.corelib.components.PasswordField; > import org.apache.tapestry5.ioc.annotations.Inject; > > public class Login > { > @Persist > @Property > private String userName; > > @Property > private String password; > > @Inject > private UserAuthenticator authenticator; > > @InjectComponent > private PasswordField passwordField; > > @Component > private Form form; > > /** > * Do the cross-field validation > */ > void onValidateFromForm() > { > if (!authenticator.isValid(userName, password)) > { > // record an error, and thereby prevent Tapestry from emitting > a "success" event > form.recordError(passwordField, "Invalid user name or > password."); > } > } > > /** > * Validation passed, so we'll go to the "PostLogin" page > */ > Object onSuccess() > { > return About.class; > } > } > > > <html t:type="layout" title="Contact com.epulse" > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" > xmlns:p="tapestry:parameter"> > > <h1>Please Login</h1> > > <form t:type="form" t:id="loginForm"> > > <t:errors/> > > <t:label for="userName"/>: > <input t:type="TextField" t:id="userName" > t:validate="required,minlength=3" size="30"/> > <br/> > <t:label for="password"/>: > <input t:type="PasswordField" t:id="password" > t:validate="required,minlength=3" size="30"/> > <br/> > <input type="submit" value="Login"/> > </form> > > </html>