• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Navigating to the content on the same page

I have a JSF page which is very lengthy. I have some links at the top of the page. If the user selects a link, the correspondinf content has to be displayed which is located on the same page. How can I implement this?

Similarly, How to implement "Go to Top" or "Go to Bottom" in the same page?

What JSF related tag should I use to achieve this? (as like <a> tag in html)
0
Kadhiravan
Asked:
Kadhiravan
  • 5
  • 2
5 Solutions
 
Michel PlungjanIT ExpertCommented:
<a name="top">This is top</a>

<a href="#bottom">Go to bottom</a>

<a href="#otherpart">Go to other part</a>
.
.
..
<a name="otherpart">Here is other part</a>


.
.

<a name="bottom">This is bottom</a>

<a href="#top">Go to top</a>

It is called an anchor
0
 
qwerty021600Commented:
This can be achieved using Named Anchor to the hyperlink.
<a name="z" id="z"></a>
0
 
Michel PlungjanIT ExpertCommented:
erm... and this comment expands on what I already said in what way?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Michel PlungjanIT ExpertCommented:
PS: If you want javascript, you can do

<a href="#" onClick="window.scrollTo(0,0); return false">Top</a>

and
<a href="#" onClick="document.getElementById('someId').scrollIntoView(); return false">scroll to someId</a>
0
 
KadhiravanAuthor Commented:
Hi,  Thanks for your response. Can you please let me know how this can be done in JSF page as we not supposed to use HTML tags in JSF page (constructed using JSF and Tomahawk tags.).
0
 
Michel PlungjanIT ExpertCommented:
One way:

http://www.horstmann.com/corejsf/jsf-tags.html#Table4_18

<h:outputLink value="#conclusion" title="Go to the         conclusion"> <h:outputText value="Conclusion"/>         </h:outputLink>


0
 
KadhiravanAuthor Commented:
I got the page scroll working fine. Thanks for your help.
0
 
Michel PlungjanIT ExpertCommented:
And why a "B" ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now