一、struts2报错:
There is no Action mapped for namespace [/customer] and action name [CustomerServlet] associated with context path [/ssh-1].
原因:1、文件名错误struts.xml
2、文件位置有误struts.xml在src目录下
3、类文件编译位置:一般是build/clssses,不在WEB-INF下,找不到struts.xml文件
struts.xml位于src下,是为了编译后能找到struts配置文件,确保其在WEB-INF下才是标准
web项目更改默认编译输出路径(默认是build):
项目右键 -》properties -》Java Build Path -》source -》Default output folder,选择你的路径
(项目遇到的问题尚未解决,待之后补充)
二、初次创建项目时,导入静态页面报错:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
原因:JavaWeb工程未添加tomcat运行相关类导致
解决:右击web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Tomcat Server
完成后,切换到Java Build Path界面中的Orader and Export,选择Tomcat。
若是eclipse尚未添加Runtime Environment,则在打开Server Runtime后是空白页面,需要添加服务器
window->Preferences->Server->Runtime Environment -> add --> 选择Apache版本,Next,填入你apache服务器软件的安装(解压后)地址,之后再次添加tomcat服务器到你的javaweb项目中即可。