datepicker plugin of jQuery does not send the value to back-end
-
23-12-2019 - |
Question
I am using jQuery to show calendar, it perfectly work but when I submit the form back-end does not receive the result >> result is null.
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$("#datepicker").datepicker();
});
JSP
...
<s:textfield id="datepicker" name="datepicker"/>
...
Java
private String datepicker;
public String getDatepicker() {
return datepicker;
}
public void setDatepicker(String datepicker) {
this.datepicker = datepicker;
}
Generated HTML
<input type="text" id="datepicker" value="" name="datepicker" class="hasDatepicker">
Solution
The value is empty for your textfield, so you might try to set the value
<s:textfield id="datepicker" name="datepicker" value="%{datepicker}"/>
and make sure the params
interceptor is configured to the action that submits the form enclosed the textfield above.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow