百度ueditor富文本编辑器插件出现“Unable to compile class for JSP”错误,是因为ueditor中“controller.jsp”这个java文件没有被编译到,具体错误如下:
严重: Servlet.service() for servlet [jsp] in context with path [] threw exception [Unable to compile class for JSP: An error occurred at line: [14] in the generated java file: [D:\web\src\project\english\target\tomcat\work\Tomcat\localhost \_\org\apache\jsp\Widget\ueditor\_1_4_3_3\jsp\controller_jsp.java] Only a type can be imported. com.baidu.ueditor.ActionEnter resolves to a package An error occurred at line: 12 in the jsp file: /Widget/ueditor/1.4.3.3/jsp/controller.jsp ActionEnter cannot be resolved to a type 9: 10: String rootPath = application.getRealPath( "/" ); 11: 12: out.write( new ActionEnter( request, rootPath ).exec() ); 13: 14: %>
当出现“Unable to compile class for JSP”这种错误的时候,我们应该检查是否缺少了一些jar包,在我们下载的ueditor插件下lib文件夹下有一些jar包,如图:
解决方案:
在我们的javaweb项目下的WEB-INF目录下新建lib目录,将上方的jar包全部加入到WEB-INF目录下的lib文件夹中即可。不管是不是ueditor插件,只要是“Unable to compile class for JSP”错误,都是因为缺少jar包导致java文件无法编译造成的。