Hi ..
noob here with a problem ...
I have a web page with Login link on it ...
add(new Link<String>("login-page-link") {
public void onClick() {
setResponsePage(Login.class);
}
});
and this link should open Login page
Login.java
public class Login extends WebPage {
private TextField<String> userIdField;
private PasswordTextField passField;
private Form<String> form;
public final class LoginForm<T> extends Form<T> {
private static final long serialVersionUID =
-8787841681239143760L;
public LoginForm(String id) {
super(id);
}
@Override
public void onSubmit() {
String userId = Login.this.getUserId();
String password = Login.this.getPassword();
System.out.println("You entered User id "+ userId + "
and Password " +
password);
}
}
public Login(){
userIdField = new TextField<String>("user", new
Model<String>(""));
passField = new PasswordTextField("password",new
Model<String>(""));
/* Make sure that password field shows up during page re-render
**/
passField.setResetPassword(false);
form = new LoginForm<String>("loginForm");
add(form);
form.add(userIdField);
form.add(passField);
}
protected String getUserId() {
return userIdField.getModelObject();
}
protected String getPassword() {
return passField.getModelObject();
}
}
Login.html
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
xml:lang="en"
lang="en">
<head>
<script type="text/javascript"
src="js/ext-core-debug.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
</head>
<body>
<h1>LOGIN PAGE</h1>
<form wicked:id="loginForm">
<p>
User-name: <input type="text" wicket:id="user" /><br />
Password: <input type="text" wicket:id="password" /><br
/>
<input type="submit" value="Login"/>
</p>
</form>
</body>
</html>
and I get this exception:
WicketMessage: Unable to find component with id 'user' in [Page class =
com.dropchop.jop.kliping.web.pages.Login, id = 1, version = 0]. This means
that you declared wicket:id=user in your markup, but that you either did not
add the component to your page at all, or that the hierarchy does not match.
[markup =
vfszip:/home/armando/programs/jboss-5.1.0.GA/server/default/deploy/kliping.war/WEB-INF/classes/com/dropchop/jop/kliping/web/pages/Login.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
xml:lang="en"
lang="en">
<head>
<script type="text/javascript"
src="js/ext-core-debug.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
</head>
<body>
<h1>LOGIN PAGE</h1>
<form wicked:id="loginForm">
<p>
User-name: <input type="text" wicket:id="user"/><br />
Password: <input type="text" wicket:id="password"/><br
/>
<input type="submit" value="Login"/>
</p>
</form>
</body>
</html>
, index = 13, current = '<input type="text" wicket:id="user"/>' (line 16,
column 15)]
Root cause:
org.apache.wicket.markup.MarkupException: Unable to find component with id
'user' in [Page class = com.dropchop.jop.kliping.web.pages.Login, id = 1,
version = 0]. This means that you declared wicket:id=user in your markup,
but that you either did not add the component to your page at all, or that
the hierarchy does not match.
[markup =
vfszip:/home/armando/programs/jboss-5.1.0.GA/server/default/deploy/kliping.war/WEB-INF/classes/com/dropchop/jop/kliping/web/pages/Login.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
xml:lang="en"
lang="en">
<head>
<script type="text/javascript"
src="js/ext-core-debug.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
</head>
<body>
<h1>LOGIN PAGE</h1>
<form wicked:id="loginForm">
<p>
User-name: <input type="text" wicket:id="user"/><br />
Password: <input type="text" wicket:id="password"/><br
/>
<input type="submit" value="Login"/>
</p>
</form>
</body>
</html>
, index = 13, current = '<input type="text" wicket:id="user"/>' (line 16,
column 15)]
at
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:474)
at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1442)
at
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1528)
at org.apache.wicket.Page.onRender(Page.java:1565)
at org.apache.wicket.Component.render(Component.java:2450)
at org.apache.wicket.Page.renderPage(Page.java:914)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
I'm trying all the examples, reading Apache wicked book on how to create
form with text fields but cant figure it out .. does anyone know, what is
really wrong !??!?!
Kind regards
Armando
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-Form-problem-tp2280712p2280712.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]