Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:39:59+00:00 2026-06-05T16:39:59+00:00

A issue I am facing with struts2.0.14’s date time picker tag The problem is

  • 0

A issue I am facing with struts2.0.14’s date time picker tag

The problem is that struts2 datetimepicker displayformat attribute
must always be set to format of tomcat server date time format else
the submitted values are null.

Change Date time setting by in Win 7:

  1. RightClick bottom right corner date.
  2. Click on Change Date & Time Settings
  3. Change calender settings
  4. Change Regional Settings
  5. Set Format as English(India)

Repro Steps

  1. Change the Regional Settings as mentioned above & restart the tomcat server.
  2. Now do not use any displayformat or use display format other than “dd/mm/yyyy” in date time picker
  3. Submit the struts2 form with date 21/12/2012
  4. In Action submitted date is set to null
  5. Now change the regional setting to English(US) and do not use any displayformat and restart the server.
  6. Values in action are set as submitted through form.

Expected result

  1. Whatever is the system date time format then date must be parsed accordingly and made available in action.

Envi:

Java 6, Struts2.0.14, Firefix 12, tomcat 6.

Any workarounds or fixes through properties or something?

*Note: Do not answer if the answer is to use jquery or some other js lib or an upgrade.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:40:02+00:00Added an answer on June 5, 2026 at 4:40 pm

    You need to use your custom DateTime converter.

    In your xwork-conversion.properties (create if you don’t have one) file put this line:

    java.util.Date = org.yourproject.common.StringToDateTimeConverter

    And in your StringToDateTimeConverter, have code something like this

    import java.util.*
    import java.text.DateFormat.*;
    
        public class StringToDateTimeConverter extends StrutsTypeConverter{
    
            public Object convertFromString(Map context, String[] strings, Class toClass) {     
    
                DateFormat DATETIME_FORMAT = getDateInstance(SHORT, Locale.getDefault());
    
                if (strings == null || strings.length == 0 || strings[0].trim().length() == 0) {
                    return null;
                }
    
                try
                {
                    DATETIME_FORMAT.setLenient(false);
                    return DATETIME_FORMAT.parseObject(strings[0]);
    
                } catch (ParseException e) {
                    //throw new TypeConversionException(); <-- if you want to catch conversion error
                    return null;
                }
            }
    
            public String convertToString(Map context, Object date) {
                DateFormat DATETIME_FORMAT = getDateInstance(SHORT, Locale.getDefault());
                if (date != null && date instanceof Date) {
                    return DATETIME_FORMAT.format(date);
                } else {
                    return null;
                }
            }
        }
    

    References:

    Java Date Format for Locale

    http://www.roseindia.net/java/java-get-example/java-get-default-locale.shtml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been facing issue with sphinx result set for string attribute. Below is
I am facing issue with proper date retrieval using date formatter.I have saved the
I am facing an issue that is driving me insane. I have one and
Recently I started facing issue with one of my scripts that loads a json
I am facing issue in binding the gridview when one of the tag in
I am using C# for my programming. I am facing issue, that my hidden
I am facing strange issue. I have wep-part that reads data from user's profile.
I am facing issue while i load a form on ajax request. i followed
The current issue im facing is comes from the following scenario. I have a
I got below JSON string, i facing issue parsing because it contains non english

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.