|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Model Question
I have the following code to allow the user to select the date that a report is to be generated for. For some reason, though, whatever date is selected from the textfield, the previous date is being used. For example, if the user inputs 07/06/2009 into the dateTextField, 07/05/2009 is being used. I'm assuming this is because I'm using the wrong model, so any assistance would be greatly appreciated.
public class AccountingDashboardPage extends EzdecBaseWebPage { private Date date; public AccountingDashboardPage(Date date) { if (date == null) { this.date = new Date(); } Form form = new Form("accountingDashboardForm", new PropertyModel(this, "date")) { @Override protected void onSubmit() { Date d = (Date)getModelObject(); setResponsePage(new AccountingDashboardPage(d)); } }; add(form); EzdecDateTextField reportDate = new EzdecDateTextField("stampDate", form.getModel()); reportDate.setModelValue(new String[]{new SimpleDateFormat("MM/dd/yyyy").format(date).toString()}); form.add(reportDate); } } |
|
|
Re: Model QuestionIs there a Calendar object under the covers somewhere? Cause it looks
like a conversion error, seeing how the months start counting from zero in the Calendar object. Regards, Linda jpalmer1026@... wrote: > I have the following code to allow the user to select the date that a > report is to be generated for. For some reason, though, whatever date > is selected from the textfield, the previous date is being used. For > example, if the user inputs 07/06/2009 into the dateTextField, > 07/05/2009 is being used. I'm assuming this is because I'm using the > wrong model, so any assistance would be greatly appreciated. > > public class AccountingDashboardPage extends EzdecBaseWebPage { > private Date date; > > public AccountingDashboardPage(Date date) { > if (date == null) { > this.date = new Date(); > } > > Form form = new Form("accountingDashboardForm", new > PropertyModel(this, "date")) { > @Override > protected void onSubmit() { > Date d = (Date)getModelObject(); > setResponsePage(new AccountingDashboardPage(d)); > } > }; > > add(form); > > EzdecDateTextField reportDate = new > EzdecDateTextField("stampDate", form.getModel()); > reportDate.setModelValue(new String[]{new > SimpleDateFormat("MM/dd/yyyy").format(date).toString()}); > form.add(reportDate); > > > > } > } > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/05/09 17:54:00 > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |