You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mauro Jeff <fb...@skynet.be> on 2006/02/13 21:54:00 UTC
Newbie : Tapestry-3.0-beta-1 - DatePicker linked to java.util.Date always at null.
Hi All,
I use the DatePicker component in a file .HTML (EncoPers.html).
I would like to use the date chosen by the user. But the problem is that in my class Java (EncoPers.java), the field corresponding (dob : java.util.Date) is always at null whereas the date is well selected .
Does anynody have an idea of the problem?
You will find herewith the detail of the files used.
Thanks in advance.
Jeff
------------------------------
EncoPers.java
package tutorial;
import java.util.Date;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;
public abstract class EncoPers extends BasePage {
public abstract void setCustName(String custName);
public abstract void setDob(Date dob);
public abstract String getCustName();
public abstract Date getDob();
public void submit(IRequestCycle cycle) {
if (getCustName() != null
&& !getCustName().trim().equals("")
&& getDob() != null) {
EncoPers welcome = (EncoPers) cycle.getPage("CustInfo");
welcome.setCustName(getCustName());
welcome.setDob(getDob());
cycle.activate(welcome);
}
}
}
------------------------------
EncoPers.html
<html jwcid="@Shell" title="Welcome Page">
<body jwcid="@Body">
<form jwcid="@Form" listener="ognl:listeners.submit">
Customer Name: <input jwcid="custName" /><br>
Date-of-Birth: <input jwcid="dob" />
<br>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
------------------------------
EncoPers.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="tutorial.EncoPers">
<property-specification name="custName" type="java.lang.String"/>
<property-specification name="dob" type="java.util.Date"/>
<component id="custName" type="TextField">
<binding name="value" expression="custName"/>
</component>
<component id="dob" type="DatePicker">
<binding name="value" expression="dob"/>
</component>
</page-specification>
------------------------------
CustInfo.html
<html>
<body>
Hello <span jwcid="@Insert" value="ognl:custName"/>!
Welcome to Tapestry!<br/>
Your Date-of-Birth is <span jwcid="@Insert" value="ognl:dob"/>.<br/>
<a href="#" jwcid="@PageLink" page="CustInfo">Next Customer</a>
</body>
</html>
------------------------------
CustInfo.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="tutorial.EncoPers">
<property-specification name="custName" type="java.lang.String"/>
<property-specification name="dob" type="java.util.Date"/>
</page-specification>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org