eclipse中出现The import com.opensymphony cannot be resolved的解决办法

来源:互联网 发布:js符文 编辑:程序博客网 时间:2024/06/14 01:10

因 为用的是最新的版本:即导入的jar包有:commons-logging-1.0.4.jar、ognl-2.6.11.jar、struts2- core-2.2.1.1.jar、xwork-2.2.1.1.jar等,在使用ActionContext()时,说cannot be resolved,后来引入import com.opensymphony.xwork2.ActionContext; 又报The import com.opensymphony cannot be resolved。其解决办法是:直接导入xwork-core-2.2.1.1.jar包就可以啦!

 

其导入步骤为:

 

右 键点击工程-->properties-->Java Build Path-->Libraries-->Add External JARs ,选择你要导入的包;也可以新建个Library ,选择User  Library然后Add JARs ,让后将你的Library导入工程。


当然若项目是个maven工程的话可以直接在pom文件中添加依赖

0 0