In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge of this article "how to use idea to build a springmvc project", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use idea to build a springmvc project" article.
1. First we can create the maven project, file- > new-> project- > maven, and now createa form archetype, so we can generate some build plug-ins for maven
two。 Write the project name and finish will be fine
3. The overall structure of the project is as follows
4. Transform it into our commonly used maven structure, create a new java package and resources package under main, mark the java package as the root path and resources as the resource root path package
4. Import the pom of springmvc. The overall pom is as follows
4.0.0 com.zy springmvc-demo2 1.0-SNAPSHOT war springmvc-demo2 Maven Webapp http://www.example.com UTF-8 1.7 5.1.6.RELEASE org.springframework spring-webmvc ${spring.version} org.springframework spring-test ${spring.version} junit junit 4.11 Test org.slf4j slf4j-log4j12 1.8.0-alpha0 test javax.servlet.jsp jsp-api 2.2 javax.servlet jstl 1.2 javax.servlet javax.servlet-api 3.1.0 springmvc-demo2 maven-clean -plugin 3.1.0 maven-resources-plugin 3.0.2 maven-compiler-plugin 3.8.0 maven-surefire-plugin 2.22.1 maven-war-plugin 3.2.2 Maven-install-plugin 2.5.2 maven-deploy-plugin 2.8.2
4.1 here we only import spring-mvc dependencies, he will automatically import spring-related packages, open the maven map, you can see that springmvc will automatically rely on spring-related jar, that is to say, import mvc-related packages, he will automatically import spring-related packages, this is the advantage of maven dependency management
5. Write DispatcherServlet in web.xml, which is the servlet of springmvc, specify the configuration file address of springmvc in the classpath:spring-mvc.xml,spring container, use ContextLoaderListener to develop the spring configuration file in classpath:applicationContext.xml
Archetype Created Web Application contextConfigLocation classpath:applicationContext.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:spring-mvc.xml 1 dispatcher / *
Configuration file for 6.springmvc
7.application profile
8. According to the springmvc.xml configuration file, create a new views package and index.jsp under WEB-INF
9. Create a new com.zy.controller package and write a controller class to do
10. Configure the tomcat server
11. Start the tomcat server, http://localhost:8080/hello, which is to test the jsp page, to test
twelve。 Enter the request address of controller in the browser and see the result.
twelve。 Successfully completed the construction of springmcx based on xml configuration.
The above is about the content of this article on "how to use idea to build a springmvc project". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.