How to reproduce specific Friendly URL?

喜欢而已 提交于 2019-12-19 11:28:04

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/5174487/how-to-reproduce-specific-friendly-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!