Skip to main content

Want to Jump to the Bottom of very large page of JSF while clicking a link

1 reply [Last post]
jsfgeeks
Offline
Joined: 2008-11-25
Points: 0

Hi all,

I am developing a JSF application. Sometimes it happens that the page is too long, and if the user presses the link, located at the bottom of the page, then the page refreshes and control goes to the top of the page. So the user can't get that what happened in the last click.

for example, if the user clicks on the link, which opens panel below that link, to fill some information, then after clicking the link, the control goes to the top of the same page rather than at the bottom. In that case the user can't get that what happened in last click. And if he/she wants to know, then they should scroll down again to the bottom.

So, if I want to move the control to the bottom, or at any desired place, of the same page, then how can I do this?

I know that, in simple HTML if we give #idOfComponent after the src in a link, then it works fine. Even I tried it in my JSF application, but didn't get success.

Any suggestions will be appreciated.

Thanks in advance,
JSF GEEKS

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jeffrey Blattman

1. put your named anchors wherever you want on the page.
2. in your bean, create a property, "loc"
3. define the JS method,

function focus(loc) {
if (loc != null) {
href = '#loc'+loc;
window.location.href = href;
}
}

4. put a call to your JS method on the page

focus('#{myBean.loc}');

5. add action listeners for your link clicks that set "loc" appropriately

On 5/25/09 6:16 AM, webtier@javadesktop.org wrote:
> Hi all,
>
> I am developing a JSF application. Sometimes it happens that the page is too long, and if the user presses the link, located at the bottom of the page, then the page refreshes and control goes to the top of the page. So the user can't get that what happened in the last click.
>
> for example, if the user clicks on the link, which opens panel below that link, to fill some information, then after clicking the link, the control goes to the top of the same page rather than at the bottom. In that case the user can't get that what happened in last click. And if he/she wants to know, then they should scroll down again to the bottom.
>
> So, if I want to move the control to the bottom, or at any desired place, of the same page, then how can I do this?
>
> I know that, in simple HTML if we give #idOfComponent after the src in a link, then it works fine. Even I tried it in my JSF application, but didn't get success.
>
> Any suggestions will be appreciated.
>
> Thanks in advance,
> JSF GEEKS
> [Message sent by forum member 'jsfgeeks' (jsfgeeks)]
>
> http://forums.java.net/jive/thread.jspa?messageID=347548
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net