aspose file tools*
The moose likes JSF and the fly likes How to set the focus or navigate to the top of the JSP after submit ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to set the focus or navigate to the top of the JSP after submit ?" Watch "How to set the focus or navigate to the top of the JSP after submit ?" New topic
Author

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

Vinodh Sa
Ranch Hand

Joined: May 06, 2010
Posts: 55
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.


Thanks, Vinodh
[Servlet tutorial]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Vinodh Sa
Ranch Hand

Joined: May 06, 2010
Posts: 55
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set the focus or navigate to the top of the JSP after submit ?