泛型的JSP编译错误 [英] JSP compilation error on Generics

查看:68
本文介绍了泛型的JSP编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个JSP页面,该页面在我的本地计算机上运行良好,但是当我在实时服务器中部署相同的代码时,它会不断抛出错误.我找不到根本原因,因为两台机器都配置了相同的JDK 1.6和tomcat 5.5,但操作系统不同,一个是Windows2003(live),另一个是Win7(local).以下是产生错误(树形图初始化)的部分,或者至少我是这样认为的:

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>>();

%>

错误:

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.

推荐答案

我设法通过替换Java编译器解决了该问题.显然,在这种情况下,Java 1.6.19 x86不支持泛型.有关此内容的更多信息: https://stackoverflow.com/a/39012681/3336066

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

这篇关于泛型的JSP编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆