How do I type a model property with a type of JSF date in the java.sql.Timestamp
Can I use primer such as component & lt; P: Calendar & gt;
? This component requires a frequency of java.util.Date
for its input and it will return the same type of java.util.Date
.
Is it possible to make converter for this matter? How do I implement a convertor to convert java.sql.Timestamp
to java.util.Date
? I think I need a JSF converter with getAsObject ()
and getAsString ()
, but I do not know where I want the conversion?
In fact, I have a list & lt; Model & gt;
to
& lt; P: dataTable & gt; Is displayed in
. In each line, I can set the start date and finish it directly from the table. Therefore, I have to use the model property directly to get the latest / updated data from the table during the save ()
process.
This is a sample for my model:
public class model {personal timestamp startdate; Private timestamp expiration date; Public timestamp getStartDate () {return startDate; } Public Zero Set StartTat (Timestamp Startup) {this.startDate = startDate; } Received public timestamps () {return end date; } Public Zero Setand (Timestamp Enddate) {this.endDate = endDate; }}
This is a sample for my bean:
public square page bean {Private list & lt; Model & gt; ListModel; Public String Save () {// Enter the database for the Update LIVERDPLODEL here on "next page"} Public listing & lt; Model & gt; GetListModel () {Return ListModel; } Public Zero set LISTODODEL (list & gt; model & gt; listModel) {this.listModel = listModel; }}
And this is a sample for my XHTML:
& lt; P: Dataable value = "# {pageBean.listModel}" var = "Model" & Gt; & Lt; P: column headertxt = "start date" & gt; & Lt; P: calendar value = "# {model.startDate}" pattern = "dd-MMM-yyyy" & gt; & Lt; / P: Calendar & gt; & Lt; / P: column & gt; & Lt; P: column header text = "end date" & gt; & Lt; P: calendar value = "# {model.endDate}" pattern = "dd-MMM-yyyy" & gt; & Lt; / P: Calendar & gt; & Lt; / P: column & gt; & Lt; / P: DataTable & gt; & Lt; P: command button value = "save" action = "# {pageBan.save ()}" Ajax = "false" />
I think it is okay to use the ideal model if the property's type of property is java.util.Date
, but I'm "code" of java Type is found Sql.Timestamp here.
No comments:
Post a Comment