Does Tapestry 5 Have composite components
I'm trying to write a composite component like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
<t:select t:id="yearField" t:value="year" t:blankOption="always" t:model="yearModel" class="select"/>
<t:select t:id="monthField" t:value="mont开发者_JAVA百科h" t:blankOption="always" t:model="monthModel" class="select"/>
</t:container>
So that I can use it like this
<t:dateselector t:value="testDate"></t:dateselector>
But I can't find exactly which method to use to get the individual elements and construct the date element. Any ideas?
You'll have to add a value
parameter of type Date
and getters and setters for the year
and month
properties in your component class:
public class MyDatePicker {
@Parameter
private Date value;
public Integer getYear() { ... }
public void setYear(Integer year) { ... }
public Integer getMonth() { ...}
public void setMonth(Integer month) { ... }
}
You could use Java's Calendar or the vastly superior Joda Time to get/set the different parts of your date value.
精彩评论