在JSF 2中使用faces-config.xml是什么?
发布时间:2020-12-16 08:15:26 所属栏目:百科 来源:网络整理
导读:JSF 2大的支持注释后,我想知道我会使用faces-config.xml。它现在的重要性是什么? 换句话说,什么配置只能通过faces-config.xml而不是通过注释来完成? 现在我使用它的所有的是声明Spring的EL解析器。 ?xml version="1.0" encoding="UTF-8"?faces-config xm
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>
它仍然被用于许多无法注释的事情。例如。自定义JSF验证消息:
<application> <message-bundle>com.example.i18n.messages</message-bundle> </application> 全局i18n软件包(以便您不需要在每个视图中声明< f:loadBundle>): <application> <resource-bundle> <base-name>com.example.i18n.Text</base-name> <var>text</var> </resource-bundle> </application> 显式支持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> 自定义view handlers: <application> <view-handler>com.example.SomeViewHandler</view-handler> </application> Phase listeners(仍然没有注释): <lifecycle> <phase-listener>com.example.SomePhaseListener</phase-listener> </lifecycle> 无法注释的托管bean(下面的#提供了#{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> 自定义工厂,如自定义异常处理程序工厂(它也允许工厂为 <factory> <exception-handler-factory>com.example.SomeExceptionHandlerFactory</exception-handler-factory> </factory> 只列出常用的。如果你在IDE中有faces-config.xml标签自动完成,你可以找到它们。由于新的注释和隐式导航,只需要被管理的bean,验证器,转换器,组件,渲染器和点对点导航情况。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- swift – 在if语句中计算可选对象的Bool属性
- solr全文检索技术学习(一)-核心配置文件solrconfig.xml
- 使用AXMLPrinter2.jar包反编译XML文件
- ruby-on-rails – 多次在RSpec中运行Rake任务返回nil?
- fastjson过滤属性,重点在于PropertyFilter 这个东西(应用
- c – 如何将winhttp api与“transfer-encoding:chunked”一
- 在cocos creator中使用protobufjs(三)
- C#:XNA与无XNA(性能)
- C#中的通用消息传递模式
- React Native 二:在ubuntu MATE 16.04 下搭建React Native