我正在将Web应用程序从Websphere 6.1迁移到Websphere 8,并且在我的JSP
页面之一中遇到以下错误:
com.ibm.ws.jsp.translator.JspTranslationException:JSPG0227E:翻译/jsp/myJsp.jsp时捕获到异常:/jsp/myJsp.jsp(863,4)-> JSPG0122E:无法解析EL函数$ {不为空rowVo.operation.package}。在com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateElFunction(ELValidator.java:500)在com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateELExpression(ELValidator.java:122)在com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateCustomTagAttribute(ValidateVisitor.java:1757)的com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateELExpression(ELValidator.java:149)在com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.visitCustomTagStart(ValidateVisitor.java:294)上的com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateCustomTagAttributeValues(ValidateVisitor.java:1405)在com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:366)在com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419) com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisit)上的.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369)或com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369)处的com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java: 419),位于com.ibm.ws.jsp.translator.visitor.JspVisitor.visit(JspVisitor.java:216)上com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:234)上com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:254)上的.ibm.ws.jsp.translator.JspTranslator.processVisitors(JspTranslator.java:127) .translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:121)JSP
文件中有问题的部分如下所示:
<c:forEach var="rowVo"
items="${searchResultContainer.searchResultRowsPage}"
varStatus="opStatus">
<c:if test="${not empty rowVo.operation.jobscopeDescription}">
<td>${rowVo.operation.jobscopeDescription}</td>
</c:if>
<c:if test="${not empty rowVo.operation.package}">
<td>${rowVo.operation.package}</td>
</c:if>
</c:forEach>
真正令我困惑的是,当第二个
EL
表达式几乎相同时,它从第三个Operation
表达式引发。ojit_code是一个生成的类:
public class Operation {
//Other properties omitted
@XmlElement(name = "package")
protected List<Package> _package;
protected List<String> jobscopeDescription;
public List<Package> getPackage() {
if (_package == null) {
_package = new ArrayList<Package>();
}
return this._package;
}
public List<String> getJobscopeDescription() {
if (jobscopeDescription == null) {
jobscopeDescription = new ArrayList<String>();
}
return this.jobscopeDescription;
}
}
这些文件在迁移期间未更改,并且在WAS 6.1上运行良好。有人知道这是怎么回事吗?
最佳答案
WebSphere Application Server v8.0及更高版本中增强了负责检查是否将保留关键字用作EL变量标识符的代码,从而使检查更加严格。变量检查代码不仅检查保留的EL关键字,还检查Java保留的关键字。
有关更多信息,请参见本文:http://www-01.ibm.com/support/docview.wss?uid=swg21642419&myns=swgws&mynp=OCSSEQTP&mync=A