4

我想了解 JSF 中的 EL 解析器。我们可以在一个项目中使用多个 EL 解析器吗?比方说,如果我使用 Spring 的DelegatingVariableResolver,我可以添加另一个像 Seam 的 EL 解析器SeamELResolver吗?

我的期望是,DelegatingVariableResolver当他在翻译过程中遇到错误或异常时,委托另一个 EL 解析器。

4

1 回答 1

0

DelegatingVariableResolver 自 Spring 3.2 起已弃用,那么是的,您可以将多个 ElResolver 声明为:

<application>
    <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>     
    <el-resolver>com.agitech.erp.bean.BeanResolver</el-resolver>    
  <locale-config>
   <default-locale>fr</default-locale>
  </locale-config>
 </application>
public class BeanResolver extends javax.el.ELResolver {
........
}

如果您使用 MyFaces,您可以选择自定义解析器的订购方式

<context-param>
    <param-name>org.apache.myfaces.EL_RESOLVER_COMPARATOR</param-name>
    <param-value>org.apache.myfaces.el.unified.CustomLastELResolverComparator</param-value>
</context-param>
于 2014-03-31T21:38:04.230 回答