• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set the focus or navigate to the top of the JSP after submit ?

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Can anyone help me with how to make the webpage navigate to the top of the jsp, after submit method is called.

My problem is to make the webpage navigate to the top of the JSP after submit method is called. When i click oon submit method, my entire form is validated and based on the validations certain error messages are thrown. These messages/validation are thrown frm backing bean and not during JSF lifecycle validation phase, since we have many dependency validations, we cant go with JSF lifecycle validations.

Any suggestion(possibly without use of any javascript) would be helpful for me.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're submitting the entire View (non-AJAX), the entire webpage should be replaced, and by default that will be rendered from the top down the screen.

However, if you're doing an AJAX submit, only part of the display would be re-rendered and therefore the page would not scroll. To force it to scroll, you would have to use JavaScript, I'm afraid. I don't recall the JavaScript code that would be required, but you'd normally invoke it using an "oncomplete" attribute attached to the submit button or action.
 
Vinodh Sa
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:If you're submitting the entire View (non-AJAX), the entire webpage should be replaced, and by default that will be rendered from the top down the screen.

However, if you're doing an AJAX submit, only part of the display would be re-rendered and therefore the page would not scroll. To force it to scroll, you would have to use JavaScript, I'm afraid. I don't recall the JavaScript code that would be required, but you'd normally invoke it using an "oncomplete" attribute attached to the submit button or action.



Hi Tim,
I m not using any AJAX method to submit. Its just a normal action method called from h:commandButton which is inside a h:form which is enclosed by a f:subview tag. And the view is in the layout page, so i m afraid i m not submitting the entire View. Since there is no need to submit the layout page.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic