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

  • Home
  • SEARCH
  • 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 4332854
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:18:48+00:00 2026-05-21T10:18:48+00:00

I have a field length in one of my struts 2 form. The data-type

  • 0

I have a field “length” in one of my struts 2 form. The data-type of “length” is “double”. I have applied the “double” validation in XML file. But when I key-in alphabets in the “length” text field, it shows the error message as

Invalid field value for field "length"

I don’t want this message to be shown like this. This message is generated by struts 2 itself and not entered by me. I guess, this message comes as the conversion of data fails. I also applied the “conversion” validator, but the above error message is still showing up. Please suggest the solution.

Thanks in advance.

  • 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-05-21T10:18:49+00:00Added an answer on May 21, 2026 at 10:18 am

    You’re in luck. This text is customizable.

    The text is defined in xwork-messages.properties in the xwork jar. You can override it by adding the following to your global i18n resource bundle:

    xwork.default.invalid.fieldvalue=Invalid field value for field "{0}".
    

    As you guessed, this error message occurs for all type conversion failures. The XWorkConverter class has some useful javadoc about this:

    Any error that occurs during type conversion may or may not wish to be reported. For example, reporting that the input "abc" could not be converted to a number might be important. On the other hand, reporting that an empty string, "", cannot be converted to a number might not be important – especially in a web environment where it is hard to distinguish between a user not entering a value vs. entering a blank value.

    By default, all conversion errors are reported using the generic i18n key xwork.default.invalid.fieldvalue, which you can override (the default text is Invalid field value for field "xxx", where xxx is the field name) in your global i18n resource bundle.

    However, sometimes you may wish to override this message on a per-field basis. You can do this by adding an i18n key associated with just your action (Action.properties) using the pattern invalid.fieldvalue.xxx, where xxx is the field name.

    It is important to know that none of these errors are actually reported directly. Rather, they are added to a map called conversionErrors in the ActionContext. There are several ways this map can then be accessed and the errors can be reported accordingly.

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

Sidebar

Related Questions

I have a XML file containing metadata like a field's maximum length. I have
I have the following XML document named testFix.fix <WriteFixedWidth Type=extract> <Position Start=1 Length=15 Name=Field1
I have to get the records from a table field where Length of record/data/string
I have a project that merges in one form field two variables. Number of
I have a two field HTML form for newsletter signup. One field is for
I have one form with only one single field. When I submit the form,
In here one field named to[0] is used...but actually I have them 'N' times
I have a text field whose length I would like to limit at the
I have field that it's not a key (it's text) and I want to
I have a form which contains list of data, I added a checkbox in

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.