Jsp – Pop up calendar for date selection in jsp


How to add a date picker (pop up calendar) for date selection in jsp ?

I am developing a web application. I want a calendar in jsp so that user can easily choose a date from that calendar instead of typing and validating the date.

Best Solution

Depending on your application architecture, you can choose one of the following approaches:

1) a server side approach (writing a 'datepicker' JSP tag) For example, the struts2 framework has a datepicker JSP tag: http://code.google.com/p/struts2-jquery/wiki/DatePickerTag

2) a client side approach (using a javascript widget to display datepicker) There are many JS widgets out there and you can choose one depending on the complexity of the feature set you want. (jquery plugins, dojo both offer datepickers)

You may want to consider the overall application architecture when making this choice as this choice will typically have impact on all your webpages (as you discover the need to use more widgets in your UIs)