Hi,
I have problems with updating models with data from page, I can't
uderstand why it dosn't work :(
Can anybody tell me what I'am doing wrong ?
There is my very simple sample.
package wicket.examples.my;
import java.io.Serializable;
import wicket.markup.html.WebPage;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.RequiredTextField;
import wicket.model.IModel;
import wicket.model.Model;
import wicket.model.PropertyModel;
public class TestFieldPage extends WebPage {
class Person implements Serializable {
private String name = "TEST";
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
public TestFieldPage() {
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 RequiredTextField("name", new PropertyModel(
model, "name")));
}
public void onFormSubmitted() {
System.out.println(((Person) getModelObject()).getName());
}
}
}
with this markup:
<?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">
Name: <input type="text" wicket:id="name"/>
</form>
</body>
</html>
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user