Hello !
I am newbie to Wicket, just figuring out how stuff works. Now i am stuck
with how to use input fields in forms. My input field retuns null...Can
someone tell me what i am doing wrong?
Thanks in Advance, my code is listed below.
Greetz
Sebastian
Java Code:
public class TestPage extends WebPage {
class Person implements Serializable {
private String name = "TEST";
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
public TestPage() {
Person person = new Person();
add(new TestForm("testForm", new Model(person)));
}
class TestForm extends Form {
public TestForm(String id, IModel model) {
super(id, model, null);
add(new TextField("name", new PropertyModel(
model, "name")));
}
public void onSubmit() {
System.out.println("----------------------------------");
System.out.println(((Person) getModelObject()).getName());
System.out.println("----------------------------------");
}
}
}
HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Wicket Example</title>
</head>
<body>
<form wicket:id="testForm" method="get">
Name: <input type="text" wicket:id="name"/>
<input type="submit" value="save" />
</form>
</body>
</html>
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user