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 3806294
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:48:47+00:00 2026-05-19T14:48:47+00:00

I have done some searches on the web and in stackoverflow to see how

  • 0

I have done some searches on the web and in stackoverflow to see how to handle the following message that I get on one of my screens:

Failed to convert property value of
type [java.lang.String] to required
type [java.lang.Long] for property
‘qtyToShip’; nested exception is
java.lang.IllegalArgumentException:
Could not parse number: Unparseable
number: “a”

From research and from looking at the web I assumed that adding the following to my errors.properties file would produce the desired results:

typeMismatch.shippingCommand.qtyToShip=1. Invalid value for Qty To Ship, accepts only numbers.  
typeMismatch.qtyToShip=2. Invalid value for Qty To Ship, accepts only numbers. 
shippingCommand.qtyToShip=3. Invalid value for Qty To Ship, accepts only numbers. 
qtyToShip=4. Invalid value for Qty To Ship, accepts only numbers.


typeMismatch.java.lang.NumberFormatException=5. Invalid value for {0}, accepts only numbers. 
typeMismatch.java.lang.Integer=Must specify an integer value. 
typeMismatch.java.lang.Long=Must specify an integer value. 
typeMismatch.java.lang.Float=Must specify a decimal value. 
typeMismatch.java.lang.Double=Must specify a decimal value.  
typeMismatch.int=Invalid number entered 
typeMismatch=Invalid type entered

I add integer values to the message to determine which one would show up.

Now at the top of my JSP I have the following:

  <center>
    <spring:hasBindErrors name="shippingCommand">
      <c:if test="${errors.errorCount > 0 }">
        <h4>Following errors need to be corrected:</h4>
        <font color="red">
          <c:forEach items="${errors.allErrors}" var="error">
            <spring:message code="${error.code}" arguments="${err.arguments}" text="${error.defaultMessage}"/><br />
          </c:forEach>
        </font>
      </c:if>
    </spring:hasBindErrors>
  </center>

The above is outside my Form, inside my Form I have the following (testing out ideals)

So the results is that when I run my code to trigger the error, I see that inside my form I get the following message:

1. Invalid value for Qty To Ship, accepts only numbers.

Which comes from this: typeMismatch.shippingCommand.qtyToShip

The outside of the form displayes:

Invalid type entered

What I do not understand is why am I able to display the correct message inside my form but not outside?

In the controller I have added the following:

@Override
protected void initBinder(HttpServletRequest pRequest, ServletRequestDataBinder pBinder) throws Exception
{
    NumberFormat numberFormat = NumberFormat.getInstance();
    pBinder.registerCustomEditor(Long.class, "qtyToShip", new CustomNumberEditor(Long.class, numberFormat, false));
}

Thanks

  • 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-19T14:48:47+00:00Added an answer on May 19, 2026 at 2:48 pm

    Perhaps error.code doesn’t guarantee to return the most specific message code. Try to pass error message as a whole:

    <spring:message message = "${error}" />   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've done some searches and see IN THE PAST there have not been any
Have done some research and found some stuff that may be helpful. I would
I have done some research and it really seems that implementing a transaction system
I have done some research on the above and found that I am able
OK, I have done some creative searches and am kind of hitting a road
I looking for jquery validator plugin. I have done lot of searches, some plugins
I already done some searches but none of that can solve this peculiar,unexpected problem.
I have done some searches looking for information about how to do logging with
I have done some looking and I found this: http://www.codeproject.com/Articles/14439/The-ScrollableListBox-Custom-Control-for-ASP-NET-2 but to me it
I have done some commits and pushed them into my repository. Then I did

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.