Struts server-side verification problems and temporary solutions

Source: Internet
Author: User

We know that if actionform inherits validatorform, we can perform data verification in the validate () method, and its return is an actionerrors object. However, I found that after verifying invalid data input, because struts only keeps the original actionform object in the request when returning inputforward, therefore, if I have manually directed setattribute () to another object in the request in the action, the system will prompt that the object cannot be found.

The current solution is helpless, that is, to change the object originally put in the request to put in the session, but I am worried that this object will be manually cleared immediately after use, otherwise, it will cause a lot of unnecessary troubles. I do not like to use session objects myself. Especially for data transmission from actions to pages, request should be the most appropriate choice.

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.