Note that there are some explanatory texts on larger screens.

plurals
  1. POCross-form validation issue tapestry
    text
    copied!<p>I really new in Java....i work some research in java using tool Tapestry framework... I have some problem with exception when i calling @Component "Form"...tapestry throws me exception :</p> <p><strong>Embedded component(s) loginForm are defined within component class com.fit.pages.Login (or a super-class of Login), but are not present in the component template (classpath:com/fit/pages/Login.tml).</strong></p> <p>context eventType</p> <p>activate</p> <p>org.apache.tapestry5.ioc.internal.OperationException</p> <p><strong>Embedded component(s) loginForm are defined within component class com.fit.pages.Login (or a super-class of Login), but are not present in the component template (classpath:com/fit/pages/Login.tml).</strong></p> <p>trace</p> <pre><code> **Triggering event 'activate' on Index Constructing instance of page class com.fit.pages.Login Creating ComponentAssembler for com.fit.pages.Login** </code></pre> <p>my code looks something like this </p> <p>public class Login {</p> <pre><code>private String userName; @Property private String password; @Inject @Property private Users users; @SessionState private User user; @Component(id="loginForm") private Form loginForm; @Inject private Messages messages; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } void onValidate(){ User authenticatedUser = Security.authenticate(userName, password, users); if(authenticatedUser != null){ user = authenticatedUser; }else{ loginForm.recordError(messages.get("authentication-failed")); } } @OnEvent Object onSubmit(){ System.out.println("form was submited"); Class nextPage = null; User authenticatedUser = Security.authenticate(userName, password, users); if(authenticatedUser != null){ user = authenticatedUser; nextPage = Index.class; } else { nextPage = Registration.class; } return nextPage; } </code></pre> <p>and code in login.tml :</p> <p>Please log in:</p> <pre><code> &lt;t:form id="loginForm"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;t:label t:for="userName"/&gt;: &lt;/td&gt; &lt;td&gt; &lt;input type="text" t:type="textfield" t:id="userName" t:value="userName" t:validate="required"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;t:label t:for="password"/&gt;: &lt;/td&gt; &lt;td&gt; &lt;input type="text" t:type="passwordfield" t:id="password" t:value="password" t:validate="required"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2" align="center"&gt; &lt;input type="submit" value="Log In"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/t:form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload