Re: Scrolling Back to Top of page
Re: Scrolling Back to Top of page
- Subject: Re: Scrolling Back to Top of page
- From: Kaj Hejer <email@hidden>
- Date: Fri, 29 Oct 2004 23:11:52 +0200
On 22. okt 2004, at 21.38, Calven Eggert wrote:
When a WebObjects page is submitted by a popup, a couple of pages down
from the top of a page, the darn page always takes the user to the top
of the page when it’s refreshed. Is there a way to keep the page at
the current location without forcing the user to scroll back down?
HOW?
Hi!
We do this with something like:
private String anchor;
public void appendToResponse(WOResponse response, WOContext
context) {
if (anchor != null) {
response.setHeader(context.componentActionURL() +
"#" + anchor, "location");
response.setHeader("text/html", "content-type");
response.setHeader("0", "content-length");
response.setStatus(302);
anchor = null;
return;
}
super.appendToResponse(response, context);
}
public String getAnchor() {
return anchor;
}
public void setAnchor(String s) {
anchor = s;
}
and in the actionmethod where we want to jump to this anchor we use
MyPage nextPage = (MyPage) pageWithName("MyPage");
nextPage.setAnchor("myAnchor");
return nextPage;
and myAnchor is a <a name="myAnchor"></a> in the MyPage component.
-Kaj :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden