prettyfaces的URL配置

Named path parameters

<pattern value="/store/#{ cat }/" />
String category = request.getParameter("cat");

EL-injected path parameters

<pattern value="/store/#{ bean.location }/" />
@Named("bean")
@RequestScoped
public 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) 这里可以做权限检查

Load data when accessing mapped URLs

你可能感兴趣的:(bean,JSF,Blog)