0

I am new to JSF. I have a unordered list and a div.

            <ul class="nav navbar-nav">
                <li><a href="#TestPage">Test Page</a></li>
                <li><a href="#">Item1</a></li>
                <li><a href="#">Item2</a></li>
                <li><a href="#">item3</a></li>
            </ul>
            <div id="content"></div>

Now on click of the list items I want to load different xhtml pages using JSF. Is it possible to achieve this usecase? I am using JSF 2.0 and primefaces.

halfer
  • 19,824
  • 17
  • 99
  • 186
Lolly
  • 34,250
  • 42
  • 115
  • 150

2 Answers2

2

Just replace the plain HTML link by a JSF h:link. According to the docs:

Render an HTML "a" anchor element. The value of the component is rendered as the anchor text and the outcome of the component is used to determine the target URL rendered in the "href" attribute.

<li><h:link outcome="TestPage" value="Test Page" /></li>

Where the outcome attribute specifies the target navigation case.

See also:


Note that's useful for using JSF navigation cases. If you want to just perform a GET request for an external non-JSF url, just use the plain HTML way.

Aritz
  • 30,971
  • 16
  • 136
  • 217
0

On click event of <li> element, you can call $('#content').load(Url, successEventHandler)

rt2800
  • 3,045
  • 2
  • 19
  • 26