Spring mvc and jQuery DatePicker

We have added a simple CSS using the ResourceHandlers.  Now, it is the time to test jQuery on a Spring MVC. First Step is to display the calendar object on the jsp.

Spring mvc and jQuery DatePicker

Insert the scripts and CSS to head part of jsp

http://code.jquery.com/jquery-1.10.2.js
http://code.jquery.com/ui/1.11.0/jquery-ui.js

[code language=”html”]
<sc ript type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></sc ript>
<sc ript type="text/javascript" src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></sc ript>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
[/code]

Add the following javascript. Replace expenseDate with your field id

[code language=”javascript”]
$(document).ready(function() {
$(function() {
$("#expenseDate").datepicker();
});
});
[/code]

Thats all. The calendar object should rendered on the browser window.

1 thought on “Spring mvc and jQuery DatePicker”

  1. Pingback: The request sent by the client was syntactically incorrect | JavaShine

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top