在Eclipse中新建maven WEb项目后,如果没有src/main/java和src/test/java包,但是新建的时候又说这个包已经存在,可以进行如下设置:
1.eclipse->window>preferences->java->compiler->选择本地要用的Java版本
2.eclipse->window>preferences->java->installJars->修改为本地jdk
3.项目右键->buildPath configure Build Path->点击选项卡Libraries->选中JRE System Library->
点击edit->选中Alternate JRE->选择jdk
4.点击finish,点击ok,自动出现src/main/java和src/test/java
jsp页面报The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path,可进行如下设置:
1、右击web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Tomcat
Server
2、切换到Java Build Path界面中的Orader and Export,选择Tomcat
3、maven项目:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>