websphere中jsp使用el表达式 ${fn.replace}报错- 'fn:replace' not found

websphere发布应用,jsp的el表达式 ${fn.replace}报错:

[10/24/17 19:02:45:181 CST] 00000038 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [/WEB-INF/jsp/modules/xx/xx.jsp] in application [xx_war]. Exception created : [javax.el.ELException: Function 'fn:replace' not found

at org.apache.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:197)
at

错误原因:websphere不能正确处理单引号包裹的el表达式的函数。

 

解决方法:在el表达式外面用双引号包裹,而不是单引号。

例子如下:

有问题的jsp代码

<div  id ='${fn:replace(pdata.attributes.type, "|", "_")}_invest${ind.index}' ></div>

修改为:

<div  id ="${fn:replace(pdata.attributes.type, '|', '_')}_invest${ind.index}" ></div>

 

 

参考:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014934503

 

posted @ 2017-10-25 11:40  筱悦  阅读(1203)  评论(0编辑  收藏  举报