Why am I getting an error in the local JSP functions "<%!"?

We have a couple of utility functions declared at the class level in jsp. Use <%!.
I get the following error on a line containing only <%!:

Invalid character constant


Code:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
pageEncoding="ISO-8859-1"%>

<%@page import="java.sql.*"%>
<%@page import="java.util.Vector"%>

<%!

 String var1 = "something";
 ObjectXXX var2 = null;

 void initObjectXXX()
 {
 ...

If I delete two variables, our functions will start working. But they were there before, and it worked correctly.

What causes the error?

+3
source share
1 answer

This may be a character encoding problem. Your JSP header indicates the Latin encoding, so maybe someone checked the file in SVN with a different encoding, which is why the JSP compiler forbade it.

, .

+4

Source: https://habr.com/ru/post/1710395/


All Articles