2
votes

I get

org.apache.jasper.JasperException: /index.jsp(2,1) Unterminated <%@ page tag

The page tags look like this:

<%@ page import="java.util.*" %>
<%@ page import="au.edu.uwa.peb.autoextractor.model.ScanResultItem"; %> 

This seems to indicate to me that a < does not have a corresponding > tag ... is this so ... my IDE does not highlight any errors so how can I find this unterminated tag. Is there a JSP validation tool that I can use, perhaps online?

The stack trace looks like this:

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:520) org.apache.jasper.compiler.Parser.parseTagFileDirectives(Parser.java:1784) org.apache.jasper.compiler.Parser.parse(Parser.java:127) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)

org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:120) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:165) org.apache.jasper.compiler.Compiler.compile(Compiler.java:332) org.apache.jasper.compiler.Compiler.compile(Compiler.java:312) org.apache.jasper.compiler.Compiler.compile(Compiler.java:299) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

EDIT: taking away the ; as suggested gives me the following error. I know that ScanResultItem is definitely a class, as I have had this application running for quite a while. I made a few changes and now it won't compile.

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. au.edu.uwa.peb.autoextractor.model.ScanResultItem resolves to a package

2
Your edit is a whole different problem, unrelated to the originalskaffman
hey, you got solution??? because i'm facing the same problem.. Also, are you using JasperReport with it as i am using and it clearly says is JasperException..!!Anuj Patel

2 Answers

3
votes

Take away the ; at the end of the import, perhaps? Remember, the page import syntax isn't java.

3
votes

I faced the same problem.
And the answer for the mentioned question is, something wrong between the tags.

In this case the problem was the ';' character. After he fixed it another bug appeared.

In my case the code was (I use alloy UI but it's alike in many cases):

 <aui:option
    value="<%=attr.getType()%>"
   selected="<% System.out.println("bazinga") %>"
    >

And the bug was because, I can't declare: "<%...%>" but I can: <%= ...%> between these tags.

I would suggest who has this problem. Try to comment out part of the code with <%-- --%> tags.
It's an old post but I hope it'll be useful!