Solved

Navigating to the content on the same page

Posted on 2009-04-01
8
151 Views
Last Modified: 2013-11-24
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
Comment
Question by:Kadhiravan
  • 5
  • 2
8 Comments
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 220 total points
ID: 24036759
<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
 
LVL 13

Assisted Solution

by:qwerty021600
qwerty021600 earned 30 total points
ID: 24036937
This can be achieved using Named Anchor to the hyperlink.
<a name="z" id="z"></a>
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 220 total points
ID: 24037006
erm... and this comment expands on what I already said in what way?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 220 total points
ID: 24037013
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
 

Author Comment

by:Kadhiravan
ID: 24037445
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
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 220 total points
ID: 24037957
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
 

Author Closing Comment

by:Kadhiravan
ID: 31565209
I got the page scroll working fine. Thanks for your help.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24061210
And why a "B" ?
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question