0

I'm passing 2 parameters through a h:link like this:

<h:link outcome="index" value="index" >
   <f:param name="a" value="#{bean.a}"  />
   <f:param name="b" value="#{bean.b}"  />
</h:link>

In this case both params are shown in the url. How can I achieve that only param a and not b is shown in the url? Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
codyLine
  • 509
  • 2
  • 8
  • 26
  • Just remove `` for `b`? – BalusC Aug 08 '13 at 19:21
  • As I wrote below, I need the param `b` too. I have to try something else. I'm missing a property `includeViewParams` in the `f:param`. This could be the solution. Thanks – codyLine Aug 09 '13 at 18:48
  • It'd be more helpful if you elaborate in low level HTTP terms what exactly you want, then we can tell how to achieve this in JSF. So far it look like you're just asking for the impossible because you're not familiar with basic HTTP. – BalusC Aug 09 '13 at 19:13
  • I use the links as bookmarkable urls for the detail pages for locations. These links appears as a result list in a search page. If u click it from that page, u get the distance btw the location and the target address shown in the detail page. That why I need the second param. – codyLine Aug 11 '13 at 09:58
  • The code which you've so far already achieves exactly that. – BalusC Aug 11 '13 at 11:02
  • Yes! But if someone get the link of some location from somewhere else than the search page, he'll see a distance btw the location and to the `default` address, which doesn't make sense! That why I need the second param to use in search page to calculate and display the distance and should not appear in url. I hope it's clear now, what I try to achieve. – codyLine Aug 11 '13 at 12:47

2 Answers2

0

If you want only one param to be shown in url, you need to pass only one. As it is a GET request(because it is a link), you can't restrict parameters from being shown in the url

<h:link outcome="index" value="index" >
   <f:param name="a" value="#{bean.a}"  />
</h:link>
Prasad Kharkar
  • 13,410
  • 5
  • 37
  • 56
  • I need to pass another param, that I use in a backing bean method for PreRenderViewEvent. So there is no way to pass it without showing it in url? – codyLine Aug 08 '13 at 21:02
0

if you do not need your param to be shown in the URL,then use another method to save it rather than f:param method, save it in the Flash scope for example then restore it in your managed bean

hanan Ahmed
  • 442
  • 3
  • 5