我们正在尝试将 JSP/XSLT 应用程序重构为 JSF。我们使用 CMS 进行内容管理。技术:使用 Mojarra、PrimeFaces 2.2.1 和 Tomcat 6.29 的 JSF 2.0
数据结构的组织如下:
有网站。
站点包含频道。
频道包含内容。
网站、频道和内容均已翻译。
URL 看起来像:
http://whatever/firstSite
http://whatever/firstSite/aChannel
http://whatever/firstSite/aChannel/aSubChannel/myGreatContent
这是向用户显示的翻译名称。 siteName 只出现一次,频道可以出现多次,内容最多一次。
目前,我们使用 commandLinks。
操作调用更新应用程序的上下文并返回页面 ID。
现在我们想要重现友好的 URL 并用 h:link 或 outpulink (GET) 替换命令链接导航 (POST)。
我读了一些关于 FURL with JSF 的文章,并且看到了 PrettyFaces 的解决方案。
我可以用漂亮的脸重现 FURL 还是应该由我自己实现(就像 这篇文章) ?
对于 h:link,我看不到 actionListener 或 action 属性,那么我如何更新我的上下文?
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)
我肯定会推荐 漂亮面孔。您最终会得到不太复杂的代码和配置。链接文章的顶部也提到了同样的内容。
仅接受导航结果,不是 URL。请改用
。至于在 GET 请求上调用操作,请使用与视图关联的 bean 的构造函数或 @PostConstruct。
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.
The
<h:link>
only accepts a navigation outcome, not an URL. Use<h:outputLink>
instead.As to invoking actions on GET requests, use the constructor or
@PostConstruct
of the bean which is associated with the view.这是交叉发布在:http://ocpsoft.com/support /topic/how-to-reproduct-specific-friend-url(请跟进。)
This is cross posted on: http://ocpsoft.com/support/topic/how-to-reproduce-specific-friendly-url (Please follow up there.)