tags:

views:

95

answers:

1

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?

+4  A: 

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.

skaffman
Sounds logical... +1
Cerebrus
Yup that's exactly it, Tks the file was saved under UTF-8, changed it to ISO-8859-1 and it worked perfectly
fmsf