Eclipse导入web项目,ServletActionContext.*() 出错的解決方法
2013-10-03 10:37
363 查看
情况:
当使用eclipse导入web工程时,有时会提示HttpServletRequest, ServletActionContext 找不到的情况
如:
ServletActionContext.getRequest( )
ServletActionContext.getServletContext( )
原因:
在不同的机器中,服务器的配置都是不一致的。
当导入web项目文件时,eclispe并没有自动配置好项目的服务器运行环境(Targeted Runtimes)
解决方法:
配置项目的 buildpath
选中项目右键 --> properties –> Targeted Runtimes –> 选择运行的服务器
如下图红框:
由上边可知:
ServletActionContext 是属于struts2 api,明显调用了 tomcat 的api
Conclusion
用SSH的包是比较麻烦的,
如,三者之间的版本匹配问题;多了不用的包会报错;少了肯定也会报错。
当使用eclipse导入web工程时,有时会提示HttpServletRequest, ServletActionContext 找不到的情况
如:
ServletActionContext.getRequest( )
ServletActionContext.getServletContext( )
原因:
在不同的机器中,服务器的配置都是不一致的。
当导入web项目文件时,eclispe并没有自动配置好项目的服务器运行环境(Targeted Runtimes)
解决方法:
配置项目的 buildpath
选中项目右键 --> properties –> Targeted Runtimes –> 选择运行的服务器
如下图红框:
由上边可知:
ServletActionContext 是属于struts2 api,明显调用了 tomcat 的api
Conclusion
用SSH的包是比较麻烦的,
如,三者之间的版本匹配问题;多了不用的包会报错;少了肯定也会报错。
相关文章推荐
- Eclipse导入web项目,ServletActionContext.*() 出错的解決方法
- eclipse使用ServletActionContext.getRequest总是出错的解決方法
- eclipse使用ServletActionContext.getRequest总是出错的解決方法
- eclipse导入web项目报缺少servlet-api-2.3.jar、javax.servlet-api-3.1.0.jar等包方法解决
- 关于jdk版本问题导致的eclipse导入web项目出错解决方法
- Eclipse导入外部项目无法识别为web项目并且无法在部署到tomcat下解决方法
- 用eclipse导入web项目时提示的找不到servlet包的错误
- Eclipse web项目导入到myeclipse中Tomcat不能直接部署解决方法
- Web项目Eclipse无法导入Javax.servlet.*
- 从eclipse中导入到IDEA中的SpringBoot项目,启动时报错 Unable to start EmbeddedWebApplicationContext due to missing Em
- eclipse项目中关于导入的项目里提示HttpServletRequest不能引用的解决方法
- eclipse导入第三方jar包进入web项目的方法
- eclipse导入myeclipse的web项目没法识别问题解决方法
- web项目导入eclipse出错解决
- Eclipse无法导入一些相关类的方法,出现Multiple markers at this line - The type javax.servlet.ServletContext cannot be resolved.异常
- Eclipse使用servletActionContect.getResquet出错解决方法:
- eclipse建立web工程时,action引用servlet的出错的解决办法
- java web 开发中 eclipse 或myeclipse无法解析导入 javax.servlet 的解决方法
- 导入web项目到eclipse提示找不到servlet包的错误
- eclipse导入web项目时报错的解决方法