0

I am using the tabs where active index is selected by passing request parameter to the page :

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<p:tabMenu activeIndex="${param.i}" style="text-decoration: none">
    <p:menuitem value="Home" outcome="/home.xhtml">
        <f:param name="i" value="0"/>
    </p:menuitem>
    <p:menuitem value="Sign" outcome="/web/sign/SelectServer.xhtml">
        <f:param name="i" value="1"/>       
    </p:menuitem>
    <p:menuitem value="Certificate Management" outcome="/web/sign/FileUpload.xhtml">
        <f:param name="i" value="2" />
    </p:menuitem>
    <p:menuitem value="Support" outcome="/web/sign/FileUpload.xhtml">
        <f:param name="i" value="3" />
    </p:menuitem>
    <p:menuitem value="Admin" outcome="/web/sign/FileUpload.xhtml">
        <f:param name="i" value="4" />
    </p:menuitem>
</p:tabMenu>
</ui:composition>

The problem is that it shows in the URL like : /CodesignWebApp/faces/web/sign/SelectServer.xhtml?i=1

which doesn't look good. Is there a way to pass this param as hidden. I dont see a option to do that in f:param. Or Do I have to use managed-bean to achieve that?

Akhil
  • 533
  • 2
  • 11
  • 26
  • 1
    Do you want the url to be bookmarkable for a selected tab? If yes, use it as you have, it's not a matter of looking good or not, it's all about requirements. If you don't want to declare it as a view parameter, use the [flash scope](http://stackoverflow.com/questions/11194112/understand-flash-scope-in-jsf2). – Aritz Jul 28 '14 at 11:24
  • Xtreme Biker has a very good point. Anything else would be unreasonable overhead for cosmetic benefit. – kolossus Jul 29 '14 at 05:44
  • Bookmarking the page is not at all important. But yeah point taken. – Akhil Jul 30 '14 at 05:57
  • I still have the problem when I use valueChangeListener in my form, When a value is changed after form submit I get /selectServer.xhtml page without any request parameter so active tabs goes to default one rather than current as there is no request parameter – Akhil Jul 30 '14 at 09:44

0 Answers0