-1

i have a navigation with h:commandLinks to set a backing bean und reload parts of the view via ajax. that works as expected but it produces horrible mark up because h:commandLinks have to be in a form element.

the view is as follows:

<h:body>

<nav>
    <h:form id="navigation">
        <h:commandLink
                styleClass="#{fragmentsPresenter.isActive('fragment-one.xhtml') ? 'active' : 'inactive'}"
                action="#{fragmentsPresenter.setActiveView('fragment-one.xhtml')}">
            viewOne
            <f:ajax execute="@this" render="fragment-container navigation" />
        </h:commandLink>
        <h:commandLink
                styleClass="#{fragmentsPresenter.isActive('fragment-two.xhtml') ? 'active' : 'inactive'}"
                action="#{fragmentsPresenter.setActiveView('fragment-two.xhtml')}">
            viewTwo
            <f:ajax execute="@this" render="fragment-container navigation" />
        </h:commandLink>
    </h:form>
</nav>

<h:panelGroup layout="block" id="fragment-container">
    <ui:fragment>
        <ui:include src="#{fragmentsPresenter.activeView}"/>
    </ui:fragment>
</h:panelGroup>

</h:body>

is it possible to achieve the same functionality with other jsf elements that dont require a form?

thanks in advance.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
arkhon
  • 765
  • 2
  • 11
  • 28
  • As told [here](http://stackoverflow.com/questions/24287997/dynamic-view-injection-or-routing), just `h:link` – Aritz Jun 19 '14 at 15:29

1 Answers1

0

try with >>> h:outputLink

<h:outputLink value="anything.xhtml"><h:outputText value="#{bean.text}" />
</h:outputLink>
mmateoa
  • 1
  • 1