2

I have created a JSP page which work fine in my local machine, but when i deployed the same code in the live server, it keeps throwing error. I couldn't find the root cause since both machine are configured with same JDK 1.6 and tomcat 5.5 but different OS, one is Windows2003(live) and another is Win7(local). Below is the part where error is generated (Treemap Initialization) or at least i think so :

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

<%
class Row{

String val_feature;

public Row (String val_feature) {
this.val_feature = val_feature;
}
}

Map<String, List<Row>> rowmap = new TreeMap<String, List<Row>>();

%>

Error :

Syntax error on token "<", ( expected
Syntax error, insert ")" to complete Expression
Syntax error on token "<", ( expected
Syntax error on token "(", invalid Expression

Can anyone suggest why this is happening or how to troubleshoot this error. Thanks a lot! Any suggestion is much appreciated.

user207421
  • 305,947
  • 44
  • 307
  • 483
User420
  • 137
  • 3
  • 12
  • try replacing `<` with `&lt` and `>` with `&gt` in `Map> rowmap = new TreeMap>();` – S1LENT WARRIOR Jul 25 '16 at 06:49
  • Maybe the tomcat 5.5 subversion does not like generics... You could perhaps try `Map rowmap = new TreeMap();`. But anyway, the correct way would be to put java code in a servlet that forward to the JSP. I do not like to declare a class in a JSP. – Serge Ballesta Jul 25 '16 at 07:14

1 Answers1

0

I had managed to solve the issue by replacing the Java compiler. Apparently for this case, Java 1.6.19 x86 couldn't support generics. More on this : https://stackoverflow.com/a/39012681/3336066

Community
  • 1
  • 1
User420
  • 137
  • 3
  • 12