2

I am facing problem with rewriting urls using pretty-config.xml and I want help. This is what I want.

I want to render the URL as:

http://www.example.com/{productId}

and the page actual URL is:

http://www.example.com/page/product.jsf

In short, I have one page but I want to render it each time as different url based on product id from the backing bean.

Roman C
  • 49,761
  • 33
  • 66
  • 176
SSC
  • 2,956
  • 3
  • 27
  • 43

1 Answers1

0

Sounds fairly simple. I would use this:

<url-mapping>
  <pattern value="/#{productId}" />
  <view-id value="/pages/product.jsf" />
</url-mapping>

Just make sure that you generate the correct links in your pages upon rendering.

Lincoln
  • 3,151
  • 17
  • 22
  • Thanks for your answer @Lincoln but here it is, #{myBackingBean.productId} but now it's showing /pages/product.jsf in the URL. – SSC Nov 07 '13 at 21:17
  • Not sure how that would happen. You mean the link is not being generated properly? You need to make sure that you pass all required parameters to your component. – Lincoln Nov 08 '13 at 04:19
  • I am getting the page rendered after bean method, so how it should be? – SSC Nov 08 '13 at 10:10
  • You probably just need to set the value of `#{myBackingBean.productId} ` before you navigate. These docs explain: http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html_single/#config.actions.navigation – Lincoln Nov 08 '13 at 16:34
  • Not sure how else to help without looking at your project. Perhaps you could upload a sample maven project that reproduces this issue to our support forums on http://ocpsoft.org/support/ ? – Lincoln Nov 08 '13 at 23:14