我有以下项目结构:
./WEB-INF/web.xml
./WEB-INF/lib
./WEB-INF/classes/com/a/B.class
./index.jsp
当我尝试将此项目放入tomcat webapp并尝试执行index.jsp时,会出现错误:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
Only a type can be imported. com.a.B resolves to a package
如果尝试导入其他不存在的类名,则会得到完全相同的错误。
这是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index_canvas.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>B</servlet-name>
<servlet-class>com.a.B</servlet-class>
</servlet>
</web-app>
有什么想法吗?
谢谢!