JSPG0122E:无法解析Websphere 7中的EL函数

我正在将Web应用程序移动到Websphere 7,并且我的JSP页面出现了错误。

JSPG0227E: Exception caught while translating /WEB-INF/jsp/snet/destinationTripReport.jsp: /WEB-INF/jsp/snet/destinationTripReport.jsp(211,8) --> JSPG0122E: Unable to parse EL function ${destForm.flightTable.get(loop.index).tripId}. 

发生错误的JSP部分看起来像这样。

    ${destForm.flightTable.get(loop.index).tripId} ${destForm.flightTable.get(loop.index).actualArrival} ${destForm.flightTable.get(loop.index).comment}   

让我感到困惑的是,这是使用TOMCAT运行的,但是在使用Websphere时会出现错误。

问题

Websphere 7使用JSP 2.1(Java EE5)。 JSP 2.1不支持EL表达式中的方法调用,因此${destForm.flightTable.get(loop.index)}无效,因为在EL表达式中调用了get()。

解:

要解决您的问题,您的EL表达式应该是${destForm.flightTable[loop.index].tripId}假设destForm.flightTable是可以通过索引访问的List / Array。

注意:JSP 2.2+(Java EE6 +)允许像您一样在EL表达式中进行方法调用。