prettyfaces的URL配置
来源:互联网 发布:时时彩后一分析软件 编辑:程序博客网 时间:2024/05/17 03:25
Named path parameters
<pattern value="/store/#{ cat }/" />
String category = request.getParameter("cat");
EL-injected path parameters
<pattern value="/store/#{ bean.location }/" />
@Named("bean")@RequestScopedpublic class CategoryBean {private String category;/* Getters & Setters */}
Notice, you can specify both a name and an EL value-injection for the same path-parameter.
<pattern value="/store/#{ cat : bean.location }/" />
Restrict what Path Parameters will accept (Custom regex patterns)
<url-mapping id="archives"> <pattern value="/#{ ///d{4}/ year }/#{ ///d{2}/ month }/" /> <view-id>/faces/blog/archives.jsf</view-id> </url-mapping>
<pattern value="/#{ /[a-z]+/ blogger }/#{ ///d+/ postId }/" />
Inherit from a parent URL-mapping
<url-mapping parentId="store" id="category"> ... </url-mapping>
<url-mapping id="store"> <pattern value="/store/" /> <~-- Result: /store/ --> <view-id value="/faces/shop/store.jsf" /></url-mapping><url-mapping parentId="store" id="category"> <pattern value="/#{category}" /> <~-- Result: /store/#{category} --> <view-id value="/faces/shop/category.jsf" /> </url-mapping><url-mapping parentId="category" id="item"> <pattern value="/#{item}" /> <~-- Result: /store/#{category}/#{item} --> <view-id value="/faces/shop/item.jsf" /> </url-mapping>
Dynamic view-IDs (DynaView) 这里可以做权限检查
<url-mapping id="home"><pattern value="/home/" /><view-id> #{bean.getViewPath} </view-id></url-mapping>
@Named("bean")@RequestScopedpublic class HomeBean {@Inject CurrentUser user;public String getViewPath() {if ( user.isLoggedIn() ){return "/faces/home/home.jsf";}return "/faces/login.jsf";}}
Load data when accessing mapped URLs
<url-mapping id="viewItem"> <pattern value="/store/item/#{ iid : bean.itemId }/" /> <view-id>/faces/shop/item.jsf</view-id> <action>#{bean.loadItem}</action> //这个就是相当于 页面数据加载初始化方法</url-mapping>
Invoking navigation from a page-action
<url-mapping id="viewItem"> <pattern value="/store/item/#{ iid : bean.itemId }/" /> <view-id>/faces/shop/item.jsf</view-id> <action>#{bean.loadItem}</action></url-mapping>
@Named("bean")@RequestScopedpublic class CategoryBean {public String loadItem() {if ( itemId != null ) {this.item = items.findById(itemId);return null; //return null 继续访问页面}return "failure"; //导向到一个新的地址,这就像之前用到的 动态 view-id一样}}
- prettyfaces的URL配置
- prettyfaces的URL配置 基于 annotation
- prettyfaces的 URL重写
- JSF的URL扩展 PrettyFaces
- JSF URL美化插件 PrettyFaces
- servlet的URL配置
- shiro的URL配置
- prettyfaces 之 简化导航
- UrlRewriter伪URL的配置
- Django的高级url配置
- Resteasy的rest url配置
- Kohana配置干净的URL
- servlet的url配置问题
- JSF扩展插件之prettyFaces
- JSF扩展插件之prettyFaces
- 关于shiro的URL Path Expressions[url]配置
- Filter的url匹配问题总结(url-pattern配置)
- servlet的url-pattern的配置
- vc编程时说“Cannot open include file: 'unistd.h': No such file or directory”
- linux下查看系统io情况
- OpenAFS服务器重新安装流程
- 【Android游戏开发二十三】自定义ListView【通用】适配器并实现监听控件!
- CListBox & CCheckListBox 使用技巧
- prettyfaces的URL配置
- 万无一失地取得远程IP地址
- Ajax同步与异步区别
- 提示Can't load package:dclite70.bpl解决方法
- MySql
- SVM入门(五)线性分类器的求解——问题的描述Part2
- iphone XML解析的基本流程
- 关于mysql创建临时表
- mongodb 增加数据库连接