How to reproduce specific Friendly URL?

1.1k views Asked by At

we are trying to refactor an JSP/XSLT application to JSF. We use a CMS for content management. Technologies : JSF 2.0 using Mojarra, PrimeFaces 2.2.1 and Tomcat 6.29 The organisation of the data structure is the following: There are Sites. Sites contain Channels. Channels contain Contents. Sites, channels and content are translated.

The URLs look like: http://whatever/firstSite http://whatever/firstSite/aChannel http://whatever/firstSite/aChannel/aSubChannel/myGreatContent

It's the translated name who is showing to the user. The siteName only appears once, channel can appear many times and the content at maximum once

For the moment, we use commandLinks. The action call update the context of the application and return the page id.

Now we want to reproduce the friendly URL and replace the commandlink navigation (POST) with h:link or outpulink (GET).

I read some stuffs about FURL with JSF and I saw the PrettyFaces's solution.

Can i reproduce the FURL with prettyfaces or should i implemented by mysefl (like explains in this article) ?

And with h:link, i don't see actionListener or action attribute, so how i can update my context?

2

There are 2 answers

1
Lincoln On BEST ANSWER

This is cross posted on: http://ocpsoft.com/support/topic/how-to-reproduce-specific-friendly-url (Please follow up there.)

1
BalusC On

Can i reproduce the FURL with prettyfaces or should i implemented by mysefl (like explains in this article)?

I would definitely recommend PrettyFaces. You end up with less complicated code and configuration. The same is also mentioned in the top of the linked article.

And with h:link, i don't see actionListener or action attribute, so how i can update my context?

The <h:link> only accepts a navigation outcome, not an URL. Use <h:outputLink> instead.

<h:outputLink value="firstSite/aChannel/aSubChannel">A sub channel</h:outputLink>

As to invoking actions on GET requests, use the constructor or @PostConstruct of the bean which is associated with the view.