This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JSF keep page coordinate  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Again,

Is there way, to keep the page coordinates in JSF? I have a lengthy page, and it is very annoying, that when the user submits something, the page goes to the top.
 
Bartender
Posts: 19727
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you submit a request, the page that comes back could be totally different than the page that did the submitting, so the old "page coordinate" wouldn't be valid. Since the client doesn't know what the server may do, it doesn't even try.

There are 2 ways around this.

1. Use the HTML anchor tag. If you append a "#name" to the end of a URL (before the query part), that tells the browser to position the displayed page to the named "<a> element. This is hard to do in JSF, because JSF has mostly taken over the URL structure.

2. Use AJAX. If you use AJAX, you don't request a new page, just data that will be used to update the current page. So the browser doesn't lose track of where you were positioned. If you delete the "current position", the browser will simply reposition to someplace reasonably close.
 
Gabriel Beres
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, i will go with ajax.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!