- 浏览: 80391 次
- 性别:
- 来自: 北京
文章分类
最新评论
IntelliJ IDEA 2016.3.2(64) 创建maven spring mvc webApp
一、菜单File>New>Project…
选择:Maven >org.apache.maven.archetypes:maven-archetype-webapp,Next
Next
Next
注意:在Properties列表添加archetypeCatalog=local
Next 完成
创建目录结构
设置源代码目录(这步最好在上一步之后,否则目录会合并)
合并了
pom.xml内容:有些多余的引用,以后可能用的着
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.gcy</groupId> <artifactId>springmvcdemo</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>springmvcdemo Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.3.5.RELEASE</spring.version> <spring-data.version>1.2.0.RELEASE</spring-data.version> <mybatis.version>3.4.1</mybatis.version> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- Spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.2-pre4</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> --> <!-- mybatis核心包 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${mybatis.version}</version> </dependency> <!-- mybatis/spring包 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.2.4.Final</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.6.9</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.6.9</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.3</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId> <version>1.9.11</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.10</version> </dependency> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.20</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.2</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.4</version> </dependency> <dependency> <groupId>net.sourceforge.pinyin4j</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20141113</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <!-- Logging --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <artifactId>solr-solrj</artifactId> <groupId>org.apache.solr</groupId> <version>3.5.0</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.6</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.6</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> <version>2.13.0</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.6.1</version> </dependency> <!-- Servlet --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>4.0</version> </dependency> <!-- memcached --> <dependency> <groupId>com.danga</groupId> <artifactId>memcached</artifactId> <version>2.6.6</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> <version>1.6</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-pool2</artifactId> <version>2.0</version> </dependency> <!-- memcached End--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.3</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> </dependencies> <build> <finalName>springmvcdemo</finalName> </build> </project>
webapp/WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <!--welcome pages--> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>springMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:dispatcher-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> <async-supported>true</async-supported> </servlet> <servlet-mapping> <servlet-name>springMVC</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
view/index.jsp
webapp/WEB-INF/views/index.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>${msg}</title> </head> <body> <h1>${msg}</h1> <span>${name}</span> </body> </html>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <!--启用spring的一些annotation --> <context:annotation-config/> <context:component-scan base-package="com.gcy.demo.springmvcdemo.controller"/> <!-- 静态资源(js、image等)的访问 --> <mvc:default-servlet-handler/> <!-- 开启注解 --> <mvc:annotation-driven/> <!--ViewResolver 视图解析器--> <!--用于支持Servlet、JSP视图解析--> <bean id="defaultViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> </beans>
controller/HomeController
package com.gcy.demo.springmvcdemo.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Created by gcy on 2017/1/10. */ @Controller @RequestMapping(value = "/home", method = RequestMethod.GET) public class HomeController { @RequestMapping(value = "/index", method = RequestMethod.GET) public String index(ModelMap model) { model.addAttribute("title","这是标题!"); model.addAttribute("msg", "欢迎"); model.addAttribute("name", "姓名"); return "index"; } }
配置tomcat
相关推荐
4. **框架与库支持**:IntelliJ IDEA对Spring、Hibernate、AngularJS、React等流行框架有深度集成,提供模板、快捷键和调试工具,方便开发者使用。 5. **项目导航**:通过Project视图,开发者可以轻松浏览项目结构...
在本文中,我们将深入探讨如何使用IntelliJ IDEA创建一个基于Maven的Spring MVC项目。首先,我们需要了解几个核心概念: 1. **IntelliJ IDEA**:这是一款强大的Java集成开发环境(IDE),广泛用于Java应用程序的...
而“IntelliJ IDEA2016.1汉化包”则是为了方便中国用户使用,将原英文界面翻译为中文的软件包。 汉化包的主要作用是将原本非中文的软件界面翻译成中文,使得不熟悉英文的用户能够更轻松地理解和操作软件。对于...
本篇文章将详细探讨`IntelliJ IDEA 2021.3.3`版本中的设置选项,帮助你更好地理解和优化你的开发环境。 1. **全局设置(IntelliJ IDEA Global Settings)** 全局设置是影响整个IDE工作空间的一系列配置,包括编辑...
`lombok-plugin-0.15.17-IntelliJ IDEA 2017.2.6 x64` 是一个针对 IntelliJ IDEA 的 Lombok 插件,版本号为 0.15.17,适用于 IntelliJ IDEA 2017.2.6 的 64 位版本。 Lombok 提供的主要注解包括: 1. `@Data`: ...
2018.2版本是IntelliJ IDEA的一个重要更新,引入了许多新特性、优化和修复了已知问题。对于中文用户来说,使用英文版可能会在理解和操作上遇到困扰,因此“IntelliJ IDEA 2018.2中文汉化包”应运而生,旨在为用户...
3. 重启 IntelliJ IDEA 四、总结 IntelliJ IDEA 2020.1 的正式发布,官方支持中文了,这对广大开发者来说是一个非常重要的消息。新的版本不仅仅带来了官方支持中文的功能,还带来了更加强大且功能齐全的开发体验。...
IntelliJIDEA_2018.3汉化包,自测可用。解压后按照txt文档进行粘贴,重启IDEA后即可。IntelliJ IDEA 2018.3.2 (Ultimate Edition) 【汉化作者:平方X 汉化反馈:http://www.pingfangx.com】
IntelliJ IDEA java编程语言开发的集成环境
正常安装和配置JDK后,IntelliJ IDEA 2019.3.1 x64 启动仍然报 Failed to load JVM DLL 路径\jvm.dll if you already have a 64-bit JDK installed, define a JAVA_HOME variable in 系统 ... 必须用管理员才能打开...
支持 2017.3.2 下载后直接放到安装目录下的 /lib/ 中,重启软件即可。 原创地址、更多汉化包、问题反馈、免积分下载:http://www.pingfangx.com/xx/translation
"scala-intellij-bin-2016.3.9"是针对Scala语言的一个特定版本的IntelliJ IDEA插件,该版本为2016.3.9。这个插件是专门为Scala开发者设计的,旨在提高他们在IntelliJ IDEA中的开发体验。 Scala是一种多范式编程语言...
3. **新特性**:IntelliJ IDEA 2018.2.1版本可能引入了新的特性,例如增强的代码提示、更好的代码重构工具、优化的项目导航以及对最新技术栈的支持,如Java 10和11,Spring Boot 2等。 4. **性能提升**:每次版本...
"IntelliJ IDEA 2018.3版本汉化包"就是针对这个特定版本的IDE进行中文语言支持的工具。它包含了所有界面元素、菜单、提示和帮助文档的中文翻译,使得开发者可以更加直观地理解和操作IDE的各项功能。汉化包通常以jar...
支持 2017.3.1 下载后直接放到安装目录下的 /lib/ 中,重启软件即可。 原创地址、更多汉化包、问题反馈、免积分下载:http://www.pingfangx.com/xx/translation
resources_cn_IntelliJIDEA_2017.3.2_r1.jar resources_cn_IntelliJIDEA_2017.3.3_r2.jar resources_cn_IntelliJIDEA_2017.3.4_r1.jar resources_cn_IntelliJIDEA_2017.3_r1.jar 下载解压后将对应的jar包放到idea...
将resources_cn.jar 复制到 lib 目录,重新打开就是中文 资源在网上找的,亲测试,2017.3下可以使用
IntelliJ IDEA 2019.1 汉化包,完美汉化,可以打开设置!,可以打开设置!,可以打开设置!重要的事情说三次,网上太多的版本无法打开设置,这个补丁是可以打开的,下载好直接放入idea的lib目录即可,不需要改名字,也不需要删除...
IntelliJIDEA2019.3.1iamer