当前位置: 首页 > 工具软件 > PrettyFaces > 使用案例 >

JSF的URL扩展 PrettyFaces

卫君博
2023-12-01

PrettyFaces是一个JSF1.2和JSF2.0的扩展,用来创建便于书签收藏、漂亮的网址。 PrettyFaces优雅的解决了这个问题,包括诸如功能:网页装载行动,无缝的跟faces的导航整合,动态视图的ID分配和管理参数分析,无需配置,兼容其他JSF框架。

配置示例:

<pretty-config
	xmlns="http://ocpsoft.com/prettyfaces-xsd"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://ocpsoft.com/prettyfaces-xsd 
	http://ocpsoft.com/xml/ns/prettyfaces/pretty-1.0.xsd">
	<url-mapping id="login">
		<pattern> /login </pattern>
		<view-id> /faces/login.jsf </view-id>
	</url-mapping>
	<url-mapping id="home">
		<pattern> /home </pattern>
		<query-param name="displayWelcomeMessage">#{homeBean.displayWelcomeMessage}</query-param>
		<view-id> #{homeBean.getViewPath} </view-id>
	</url-mapping>
	<url-mapping id="viewStory">
		<pattern> 
			/story/#{myBean.currentStoryId}/ 
		</pattern>
		<query-param name="commentText" decode="false">#{myBean.commentText}</query-param>
		<view-id> /faces/story/viewStory.jsf </view-id>
		<action onPostback="false">#{myBean.loadStory}</action>
	</url-mapping>
	<url-mapping id="viewComment">
		<pattern>
			/story/#{myBean.currentStoryId}/#{myBean.commentId}
		</pattern>
		<view-id>/faces/story/comment.jsf</view-id>
		<action>#{myBean.loadComment}</action>
	</url-mapping>
</pretty-config>
 类似资料: