Mah*_*leh 87 jsf faces-config jsf-2
在JSF 2对注释的大力支持之后,我想知道我将使用它faces-config.xml
.它现在的重要性是什么?
换句话说,只能faces-config.xml
通过注释而不是通过注释完成哪些配置?
现在我用它的所有东西都是声明Spring的EL解析器.
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
</application>
</faces-config>
Run Code Online (Sandbox Code Playgroud)
Bal*_*usC 139
它仍然被用于许多无法注释的东西.例如自定义JSF验证消息:
<application>
<message-bundle>com.example.i18n.messages</message-bundle>
</application>
Run Code Online (Sandbox Code Playgroud)
全局i18n捆绑包(这样您就不需要<f:loadBundle>
在每个视图中声明):
<application>
<resource-bundle>
<base-name>com.example.i18n.Text</base-name>
<var>text</var>
</resource-bundle>
</application>
Run Code Online (Sandbox Code Playgroud)
明确支持i18n语言环境(这样即使有消息包或资源包,也会忽略未声明的语句):
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>nl</supported-locale>
<supported-locale>es</supported-locale>
<supported-locale>de</supported-locale>
</locale-config>
</application>
Run Code Online (Sandbox Code Playgroud)
自定义视图处理程序:
<application>
<view-handler>com.example.SomeViewHandler</view-handler>
</application>
Run Code Online (Sandbox Code Playgroud)
阶段监听器(仍然没有注释):
<lifecycle>
<phase-listener>com.example.SomePhaseListener</phase-listener>
</lifecycle>
Run Code Online (Sandbox Code Playgroud)
无法注释的托管bean(下面给出了当前Date
打开的#{now}
):
<managed-bean>
<description>Current date and time</description>
<managed-bean-name>now</managed-bean-name>
<managed-bean-class>java.util.Date</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
Run Code Online (Sandbox Code Playgroud)
定制工厂,如自定义异常处理程序工厂(这也让工厂进行FacesContext
,ExternalContext
,LifeCycle
还有更多让你可以提供自定义实现):
<factory>
<exception-handler-factory>com.example.SomeExceptionHandlerFactory</exception-handler-factory>
</factory>
Run Code Online (Sandbox Code Playgroud)
仅列出常用的名称.如果您faces-config.xml
的IDE中有标记自动完成功能,则可以全部找到它们.由于新的注释和隐式导航,不再需要托管bean,验证器,转换器,组件,渲染器和点对点导航案例.
归档时间: |
|
查看次数: |
72187 次 |
最近记录: |