(I've read other questions on this topic, but none of them have helped)
Okay, I'm trying to import a Java class into my JSP file, but Tomcat gives me the error:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [16] in the generated java file: [I:pathoindex_jsp.java]
Only a type can be imported. org.runas.XKCDUtils resolves to a package
An error occurred at line: 7 in the jsp file: /index.jsp
XKCDUtils cannot be resolved
4: String data = null;
5: int finalComic = 1;
6: int comicNo = 1;
7: finalComic = XKCDUtils.getFinalComic();
8:
9: if (request.getParameter("page") != null)
10: comicNo = Integer.parseInt(request.getParameter("page"));
The import statement in my JSP file is:
<%@page import="java.io.*, java.net.*, org.runas.XKCDUtils" %>
The relevant section of my directory structure is:
webapps
`-ROOT
`-index.jsp
|-WEB-INF
`-web.xml
|-classes
`-org
`-runas
`-XKCDUtils.class
I'm confused because org.runas.XKCDUtils resolves to a package
, and yet it is clearly a class file, in what I believe is the correct directory.
Help, please!
(And don't chastise me for using scriptlets, I'm trying to clean them up!)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…