Bringing this back on-list after it accidentality went off-list.


On 17/05/2021 16:43, Jim Anderson wrote:

It took several hours to reduce the JSP file to a minimum, where the error still occurs, but here is the reduced file:

    <%@ page language="java" contentType="text/html" %>
    <html>
        <body>
                <%${test}%>
        </body>
    </html>

The short version is that this is not a valid JSP.

If you look at the generated Java code (in the work dir) somewhere around line 116 you'll see:

      out.write("\n");
      out.write("<html>\n");
      out.write("    <body>\n");
      out.write("        ");
 ${'test'}
      out.write("\n");
      out.write("    </body>\n");
      out.write("</html>\n");
      out.write("\n");

That won't compile. Hence the error.

The syntax for "<% ... %>" (a.k.a a scriptlet) is that you need to have valid Java code to replace the "...". "${test}" is not valid Java code.

Expression Language is not permitted within scriptlets.

What are you trying to achieve here? At a guess you want something like "<%= test %>" or "${test}" instead but it depends on your intention.

Mark




If I remove the <%${test}%> line, the JSP pages gets process properly and displays a blank page, which is correct since there isn't anything in the HTML to be displayed.

It was interesting to observer that when I ran my test cases, the typical time to run each iteration was 4 to 5 minutes, with two exceptions when the test case ran in under 2 seconds, and my guess is that it was under 1 second. The reduction process probably took about 50 test runs, but I did not count.

I hope this helps.

Jim*
*

On 5/16/21 12:56 PM, Mark Thomas wrote:
On 15/05/2021 22:34, Jim Anderson wrote:
I'm using Tomcat 8.5.63 and in the last few days I started getting an error
message in a few of my JSP files. The error message is:

________________________START ERROR____________________________

Type Exception Report

Message Unable to compile class for JSP:

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

Exception


org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: [1] in the jsp file: [/pages/list.jsp]
Syntax error on token ";", enum expected after this token
1: <%@ page language="java" contentType="text/html" %>
2: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core <http://java.sun.com/jsp/jstl/core>" %>
3: <%@ page import = "java.io.*,java.util.*" %>
4: <%@ page import="bfs.hypBeans.HypEvent" %>


_____________________________END ERROR___________________________________


As you can see, there is no semicolon in line 1 and the error message
is showing the code exactly as it is in the tomcat/webapps/... directory.



Can anyone help explain why a semi-colon error would be reported in the error message when
it does not exist in the source code?

The ';' will be in the generated Java source code. Tomcat uses "Java Debugging Support for Other Languages" to map errors in the Java source to the associated line in the JSP.

Compilation errors often don't map very well.

You want to look at the generated source for the JSP (it will be in the work directory) and see if you can figure out what is triggering the error.

Alternatively, post the source for the simplest standalone JSP that triggers the issue and the people here can try and reproduce it.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to