In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article analyzes "Struts2 Validation Framework case Analysis" with you. The content is detailed and easy to understand, "Struts2 Validation framework case analysis" interested friends can follow the editor's ideas slowly in-depth to read, I hope that reading can be helpful to everyone. Let's follow the editor to learn more about "Struts2 Validation Framework case Analysis".
First, Struts2 validation gave me a big setback from the very beginning. I finished demo according to the official document, and established a required test for a msg field, but did not intercept or check it. That sweat ah, did N just found that misunderstanding, required is to verify whether it is null, and in the jsp page to establish an input named msg, even if you do not write anything it will send you the first "", should be used is requiredstring to msg test is my purpose. After that, I seriously understood the meaning of several type of validation.
Second, after solving the previous reason, set the return value of input to the input page, verify that the intercept is successful and return to the input page, and then do not output the prompt information you should have, and it will not work to change input to s:textfield. * the reason is: when I write Struts2 validation applications, I usually set struts.ui.theme to simple, and this topic will not display error messages. Just get rid of this, or it's okay.
Xml code
< ?xml:namespace prefix = s / > < s:textfield theme="xhtml"> < /s:textfield>Three check failed to return an inexplicable page, this is true. I woke up at once after dinner. I used the convention plug-in of struts2***, after the verification failed, I will find the input return value, I did not explicitly specify the input page, so the convention plug-in will follow the rules to find actionName-input.jsp and then go to the actionName.jsp page. I said why he always went to the default page, alas, he didn't pay attention to the details for people to play with.
4. It was only after I found the problem that I remembered that I had encountered this problem a year ago and wrote a blog, but I had forgotten that the problem of sweat was that it would fail anyway, regardless of whether the msg entered a value or not. The reason is very simple. I didn't write the get method in the msg field in action, so the validation interceptor never gets the value of msg, so the check always fails.
This is the end of the case analysis of the Struts2 Validation framework. I hope the above content can improve everyone. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.