Reply To: What happened to PrettyFaces?

Splash Forums PrettyFaces Users What happened to PrettyFaces? Reply To: What happened to PrettyFaces?

#24179

0swald
Participant

Hi Chris,

As for @URLMappings, I’ve used it mostly as a storage of seo-friednly static pages with minimum functionality inside:


@URLMappings(mappings = {
	@URLMapping(id = StaticPages.MAPPING_HOME,     pattern = "/#{langBean.lang}/", viewId = "/faces/pages/pub/home.xhtml"),
	@URLMapping(id = StaticPages.MAPPING_ABOUT,    pattern = "/#{langBean.lang}/about/", viewId = "/faces/pages/pub/about.xhtml"),
	@URLMapping(id = StaticPages.MAPPING_CONTACTS, pattern = "/#{langBean.lang}/contacts/", viewId = "/faces/pages/pub/contacts.xhtml")
})
public class StaticPages {

	public static final String MAPPING_HOME = "p_mapping_home";
	public static final String MAPPING_ABOUT = "p_mapping_about";
	public static final String MAPPING_CONTACTS = "p_mapping_contacts";
...
	

OR


@URLMappings(mappings = {
	@URLMapping(id = OrderBean.MAPPING_MAIN, pattern = "/order/#{orderBean.orderId}/", viewId = "/faces/pages/priv/order.xhtml"),
	@URLMapping(id = OrderBean.MAPPING_DETAILS, pattern = "/order/#{orderBean.orderId}/details/", viewId = "/faces/pages/priv/order-details.xhtml"),
	@URLMapping(id = OrderBean.MAPPING_HISTORY, pattern = "/order/#{orderBean.orderId}/history/", viewId = "/faces/pages/priv/order-history.xhtml")
})
public class OrderBean {

	public static final String MAPPING_MAIN = "p_mapping_order_main";
	public static final String MAPPING_DETAILS = "p_mapping_order_details";
	public static final String MAPPING_HISTORY = "p_mapping_order_history";
	private String orderId;
...

As you can see, there are different pages, different mappings, but the same functionality, e.g. retrieving order by it’s id or setting the language from user’s request.

UPDATE

Speaking of programmatic navigation I didn’t mean returning Navigate class instead of String (it’s nice but obvious), but rather building URL from Navigate entity and passing it to FacesContext for redirection, something similar to the code below:


PrettyURLBuilder builder = new PrettyURLBuilder();
String url = builder.build(mapping, false, new Object[]{1,2,3});

There is a simple example where it could be useful, personally I do it in every project, – sending activation or password recovery E-Mails containing action url like http://www.mydomain.com/passrecovery/en/29b4033ca6f93ae78495108b629f3ec3fda055a0/

  • This reply was modified 8 years, 7 months ago by  0swald.
  • This reply was modified 8 years, 7 months ago by  0swald.