David, you define the page-class for your html-template in your .page file. All ognl-Refs in the html-Template are relative to the page-class. Listener method matching is done by introspection. T3 recognizes all methods with void xxx (IRequestCycle) as possible listeners. In T4 all methods returning void, String, or IPage can be called as listeners.
hope, that makes it clearer .... > -----Original Message----- > From: david b [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 23, 2006 6:02 PM > To: Tapestry users > Subject: RE: Unable to instantiate an instance of class ... > > > Schulte Marcus, > > I see what you mean... I altered my class to look like this > and I changed the HTML form. How does Tapestry know that the > this tag should go into my LoginComponent and execute the > doLogin method without having it fully defined? Anyway I got > it to work with your help and the others but it seems strange. > > <form jwcid="@Form" > listener="ognl:listeners.doLogin"> > > code changes: > ------------------- > > package com.entercite.finance.model.abstrt; > > import com.entercite.finance.model.Login; > import org.apache.tapestry.IRequestCycle; > import org.apache.tapestry.html.BasePage; > > public abstract class LoginComponent extends BasePage { > > Login login = new Login(); > > public abstract void setMessage(String message); > > public LoginComponent() { } > > public Login getLogin(){ return this.login; }; > > public void setLogin(Login login){ this.login = login; }; > > public void setUserName(String userName){ > this.getLogin().setUserName(userName); } > public String getUserName(){ return > this.getLogin().getUserName(); } > > public void setPassword(String password){ > this.getLogin().setPassword(password); } > public String getPassword(){ return > this.getLogin().getPassword(); } > > public void doLogin(IRequestCycle cycle) { > > String u = this.getLogin().getUserName(); > > String p = this.getLogin().getPassword(); > > if(isValidLogin(u,p) ) { > > System.out.println("push to main"); > > cycle.activate("Main"); > > } > > setMessage("Invalid user name or password."); > } > > private boolean isValidLogin(String userName, String password) { > return "tapestry".equalsIgnoreCase(userName); > } > } > > <html jwcid="@Shell" title="Login"> > <body> > > <span jwcid="@Conditional" condition="ognl:message"> > <font color="red"> > <span jwcid="@Insert" value="ognl:message"> Error Message </span> > </font> > </span> > > <p/> > > <form jwcid="@Form" > listener="ognl:listeners.doLogin"> > <table> > <tr> > <th>User Name:</th> > <td> > <input type="text" jwcid="@TextField" > value="ognl:userName" > size="30"/> > </td> > </tr> > <tr> > <th>Password:</th> > <td> > <input type="password" jwcid="@TextField" > value="ognl:password" > hidden="ognl:true" > size="30"/> > </td> > </tr> > <tr> > <td><input type="submit" value="Login"/></td> > </tr> > </table> > </form> > > > <hr/> > <p><a href="#" jwcid="@PageLink" page="Home">Return to Home > page</a>.</p> > </body> > </html> > > > > -- > ___________________________________________________ > Play 100s of games for FREE! http://games.mail.com/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]