Can view the tutorials best in Google Chrome, Mozilla Firefox, Opera, higher version of Internet Explorer

Struts 2 datetimepicker Example

Struts » On Oct 25, 2011 By Sivateja

Let us see how to work with this datetimepicker in struts 2, actually no need to add any external jar files to work with this,  some of us may think we need to add some Ajax related jars bla bla…,  let me clear

jars required

  • commons-logging-1.0.4.jar
  • freemarker-2.3.8.jar
  • ognl-2.6.11.jar
  • struts2-core-2.0.11.jar
  • xwork-2.0.4.jar

Let us see one example, files required

  • index.jsp
  • success.jsp
  • web.xml
  • struts.xml

Directory Structure





After Execution


By [ Java/J2EE Developer & Web Designer ]
Founder of - Indian, lives in United States. You can contact me at


9 Responses to “Struts 2 datetimepicker Example”
  1. abhishek says:

    i am using date picker in struts 2 . i have to print error message when one try to give from date is greater than to date.

  2. Java4s says:


    You can get this by using XML Validations.

    But i will prefer jQuery validations for these type of tasks :-) as easy and less time taking, try this too.

  3. Veera says:

    How to validate the datetimepisker in struts 2….? and How to store this value to database….? Whenever i try to validate using requiredstring and date then give any value in appropriate form, the value is null, mean the validation show “date is required”.Sometimes i try remove validation and store the value to database, the value is store successfully but not store appropriate value, whenever i try to store different value but always store “null”….Please help anyone…..

    Thanks in advance

    Best regards

  4. Eve says:

    Can the datepicker be used with tiles?

  5. nagappa says:

    With Jquery we can only do client-side validations and using xml files we are doing server-side validations but is ia better do both validations as many people can edit html with firebug and can click on submit

  6. anjali says:


    I am trying to use above code but i am not getting any textfield or calender to insert date.
    Please let me know need to be done

  7. Aashish says:

    How to remove Time from DateTimePicker while inserting Date into Database?

  8. Karthikeyan says:


    Here in file, you didnt extend the ActionSupport class, but you have wrote the execute method. Is it possible?? if Yes, why you didnt use the ActionSupport class here. Please explain.

  9. Hi ,
    If i use characters in that it changes to default date 01/01/70.
    how to change that date as current date??


By posting your answer, you agree to our comments policy.
Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links Current & UpComing Tutorials
Tutorials Online :
spring Hibernate struts Json Ajax Log4j Log4j
coreJava Servlets

UpComing :
JSP, Web Services [ In Progress ]
Java4s is optimized for learning java technologies, all the examples in this site are constantly reviewed to avoid errors. While using this site you agree to have read and accepted our terms of use and privacy policy
Especially i have prepared this blog by keeping fresher's in mind, however it will be very useful for real time developers too.

© 2014 Java4s All rights reserved. | strPro4Tut v(2.0) Theme designed by Team Java4s.