Why do I get an error in my JSP local functions '<%!'?
Question
We have a couple of utility functions declared on class level in jsp. Using <%!
.
I get the following error in the 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 remove the two variables our functions start working. But they were there before and it was working correctly.
What is causing the error?
Solution
It could be a character encoding problem. Your JSP header specifies the latin charset, so perhaps someone checked the file into SVN with a different encoding, which is causing the JSP compiler to barf.
Hard to spot or confirm, since the characters look OK visually.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow