JSP pages use the Struts tab to report argument type mismatch exceptions __js

Source: Internet
Author: User

Error Description:
After using the

The result is that the date in the text box and the corresponding Java.util.Date type in the form will be quoted argument type mismatch

Abnormal.

Reason:
Actionservlet when a request is received to the page, the Requestutils.populate method is invoked to fill the form.

This method is called to the Beanutils.populate method, which converts different types of values when the method is filled in.

The default actionservlet does not register the corresponding conversion function, which causes the conversion to occur incorrectly

Solution:
Convert date type to string type in 1.ActionForm
The date type is still used in 2.ActionFrom, and a DateConverter class is customized (you need to implement

Converter interface), and then registers the DateConverter in a custom Actionservlet or action base class:

Convertutils.register (New DateConverter (), Date.class).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.