电商项目-常见错误01
1、mybatis-plus的中的pojo
mybatis-plus的中的pojo主键字段必须贴上@TableId这个注解
--------------------------------------------------------------------------------
2、
<jstl.version>1.2</jstl.version>
<servlet-api.version>2.5</servlet-api.version>
<jsp-api.version>2.0</jsp-api.version>
<!-- JSP相关 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp-api.version}</version>
<scope>provided</scope>
版本找不到javax.servlet*****
servlet2.5版本太老了,
jsp相关的jar包新版本名字改了
如<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
变为了
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<!-- JSP相关 -->
<jstl.version>1.2</jstl.version>
<servlet-api.version>3.1.0</servlet-api.version>
<jsp-api.version>2.2.1</jsp-api.version>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>${jsp-api.version}</version>
<scope>provided</scope>
</dependency>
--------------------------------------------------------------------------------
3、@service注解是贴在xxxxserviceImpl的类上,不是贴在xxxxservice接口上
--------------------------------------------------------------------------------
4、war项目配置tomcat插件
父项目中的配置如:
<build>
<pluginManagement>
<plugins>
<!-- 配置Tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<!--
在插件中,指定项目的访问路径
指定项目访问的端口
-->
在ego-manager里面配置这个<path>/</path>
这样项目的入口就会直接变为http://localhost:8080/
去掉了项目名
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8080</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
</plugins>
</build>
--------------------------------------------------------------------------------
5、静态资源的支持,location要注意/WEB-INF/js/最后面的 /
<!-- 静态资源的支持 -->
<!-- 由于css、js放在了/WEB-INF目录下,意味着不能通过url直接访问。需要配置静态资源路径映射 -->
<mvc:resources location="/WEB-INF/js/" mapping="/js/**"></mvc:resources>
<mvc:resources location="/WEB-INF/css/" mapping="/css/**"></mvc:resources>