简体   繁体   中英

How Can I solve my DateTextField problem?

I am using wicket 1.5.7 version. When I tried to set DateTextField component in my first Page it is going AjaxSubmitLink's onError method in the same master class but another approval tab page.When I set dateTextField area null it is working succesful.
This java class

private DateTextField montajTarihiCombobox;
private AjaxFallbackLink sorguSubmit;
private WebMarkupContainer montajEndDatePickerContainer;

TimeChangePageClass  extends FormSekme {
 ...
  dateCombobox = new DateTextField("datePicker", new PropertyModel<Date>(model, "conversionTime"), "dd/MM/yyyy HH:mm:ss");
  montajTarihiCombobox.setOutputMarkupId(true);
   
 
  datePickerContainer = new WebMarkupContainer("datePickerContainer");
  datePickerContainer .setOutputMarkupId(true);
  datePickerContainer .add(dateCombobox );
....
}

This is HTML

            <td>
                <div wicket:id="datePickerContainer" style="clear: both;">
                    <label style="margin-bottom: 5px;">Conversion Time</label>
                    <input wicket:id="datePicker" maxlength="26"
                           class="datetimepicker large" style="width: 120px; float: none; margin-bottom: 5px !important;" type="text" />
                </div>
            </td>

This is My model Class

public class ModelClass implements Serializable {

private Date conversionTime;

...// getter and setter methods. 

}

This is the Approval Page that comes the onError method.

        stepContent.add(approvalButton = new AjaxSubmitLink("approvalButton ") {
        ....

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
        ..............
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            // THE CODE İS COMING HERE 
        }
       
      }

Use a FeedbackPanel in your page and repaint it in onError():

@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
  target.add(feedbackPanel);
}

This way Wicket will print the error causing onError() to be called in first place. Most probably the entered date (a String) cannot be converted to a java.util.Date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM