[One-stop service] Spring MVC implements a simple curd project _spring

Source: Internet
Author: User
Tags mixed spring mvc tutorial
Objective

A simple web curd system, with a never-before-many spring MVC framework, has come and harvested a lot and is recorded and shared here.


The process builds the Spring framework (MVC context, listener, set filter JSP and HTML, GBK encoding, session time, JSP configuration label)--->jdbctemplate and database configuration--->TOMCAT deployment project---> Coding (Pojo, persistence, service, controller, JSP)
Learn to harvest (go through the pit) 1. Tomcat context configuration [2]: Failed to deploy project using profile (Preliminary knowledge-> understand Tomcat deployment project three ways) 2. The error message in controller cannot be passed to the foreground pop-up

Error.cardtype is read from the configuration file and passed through Redirectattribute
redirectattributes att-->att.addattribute ("ErrorMessage", Resource.getmessage ("Error.cardtype", new object[] {},localecontextholder.getlocale ());
Through the model passed to the foreground, two steps indispensable
model.addattribute ("ErrorMessage", Request.getparameter ("errormessage"));

3. The URI contains Chinese, and Web.xml has been treated as GBK, but is still not garbled, considering that other projects will also use the uriencoding values in the Tomcat installation directory/conf/server.xml The following method is processed: First, the console gets the code in request, which can be used for processing--->log.debug (request.getcharacterencoding ()); After that, you can solve the--->new String (str.getbytes ("GBK"), "UTF-8" by using the basic coding transformation in Java.
4. The Springmvc @PathVariable contains special characters (; \/' #%) that do not include parentheses processing in the foreground can be processed in the logic, as far as possible in the foreground JS to determine whether the inclusion of special characters [3] @RequestMapping rest style [4]: Describes the regular expression Springmvc @PathVariable contains Chinese and dot number [5]: The case of the configuration file is Chinese
5. SPRINGMVC display the customized Chinese information correctly [6]
6. Do the website, it is easy to overlook the problem--->404, 500 error----------------------------- April 30, 2014 update: About threadpoolexecutor thread pool corepoolsize is worth the trouble-----------------------------7. Rules of a threadpoolexecutor pool size[17]: The article describes the thread number growth problem in threadpoolexecutor from two angles, which is worth reading 8. What is the difference between corepoolsize and maxpoolsize in the Spring threadpooltaskexecutor[18]: A relatively good answer, COREPOOLSI Ze is not the more the better,
To moderate, and before adjusting corepoolsize, first to determine whether the program itself is a problem, corepoolsize configuration in the customer site is not a lot of uncertainty, you can not modify each request Corepoolsize value------------- ----------------May 4, 2014 update: JS received in the front desk in English mixing length problem-----------------------------
9. JavaScript gets the length of the mixed string in Chinese and English [19]: Explains the cause of the problem and how to solve it. Recommended for viewing ISO/IEC 8859-1[20], which has a character chart-----------------------------May 9, 2014 update: About Tomcat 5.5 Deployment Issues-----------------------------
Tomcat 5.5 Solution for the default parsing of El expressions [21]: Because the system was previously tested on Tomcat 6.0 pass, recently replaced by 5.5, the result of the tragedy, the {}---%7b%7d problem, the first thought is a uriencoding problem, Finally, there is no way to ask the company Daniel, the original is El expression of the problem, it seems still did not see the nature of the problem ah. To learn to position the problem.
-----------------------------May 23, 2014 update:-----------------------------
Do the foreground JSP page, need to write some JS, which encountered the JavaScript parsefloat () function and $ (". Test"). The meaning of Hide (), or query W3school better AH. Best Practices 1. Although the project is complete, the understanding of spring MVC as a whole is still not clear, recommended (Spring Official document [1]) 2. The Spring MVC Tutorial, QuickStart, in-depth analysis [7], describes the major points in spring MVC, which can be used as a manual after reading the basics. 3. Follow the Tao Springmvc[8]: This is a good thing to learn about the Spring MVC series, plus the reference to the spring official can let you master this technology 4. Simple user management based on spring3.0.5 MVC [9]: Bloggers recommend viewing spring Official document 5. Spring Annotation Learning Codex (ii) control layer comb [10]: Blogger's article will be very recuperation, good 6. Spring 3.x MVC Starter Series [11]: very thorough, especially with a good map, very clear 7. Ajax no Refresh table inline edit source with database [12]: Achieve in-line editing effect 8. Java Servlet+ajax User Management (no refresh, no change, check and paging) [13]: Not all the time will be used Ajax, the page has many areas, only need to refresh an area, to use. 9. JQuery Ajax English official api[14], Chinese api[15] 10. JQuery Ajax full resolution [16]: Detailed explanation of each function, and with real-time examples to explain, to deepen understanding
References [1]. Spring 3.1.1 Official document [2]. Tomcat context configuration [3]. JS determines whether to include special characters [4]. @RequestMapping rest style [5]. The Springmvc @PathVariable contains Chinese and dot numbers [6]. SPRINGMVC Display the customized Chinese information correctly [7]. Spring MVC Tutorial, QuickStart, in-depth analysis [8]. Springmvc with the Open Tao study
[9]. Simple User management example based on spring3.0.5 MVC
[ten]. Spring Annotation Learning Codex (ii) control layer comb [11]. Spring 3.x MVC Starter Series [12]. Ajax no Refresh table inline edit source with database [13]. Java Servlet+ajax User Management (no refresh, no change, check and paging) [14]. JQuery ajax  Official API [15]. JQuery ajax  Chinese API [16]. JQuery Ajax Full parsing [17]. Rules of a threadpoolexecutor pool size [18]. What is the difference between corepoolsize and maxpoolsize in the Spring threadpooltaskexecutor [19]. In JavaScript, the length of the mixed string in Chinese and English [20] is obtained. ISO/IEC 8859-1 [21].  Tomcat 5.5 resolution of the default non-parsing El expression

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.