Re: Page Anchors
Re: Page Anchors
- Subject: Re: Page Anchors
- From: Kaj Hejer <email@hidden>
- Date: Mon, 5 Jan 2004 22:40:52 +0100
At 15:53 -0500 05-01-04, Fournier, Pete wrote:
Even though the docs for WORequest state that everything aflter the
questionmark in a URL can be obtained by calling WORequest's
queryString() I am not getting back anchor references.
For an URL like this:
http://somedomain/scripts/WebObjects.dll/MyApplication?this=that&some=wh
at#PageAnchor1
queryString() is only returning the this=that&some=what portion and
leaving off the #PageAnchor1 portion.
Any ideas on how to get the anchor reference?
Yes :)
We have the following code in the class we use as superclass for all
our components:
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;
} else {
super.appendToResponse(response, context);
}
} // appendToResponse
public String getAnchor() {
return anchor;
}
public void setAnchor(String s) {
anchor = s;
}
In the component where we want to use an anchor we just put in
<a name="myanchor"></a>
and something like the following in the code where we want to jump to
this anchor:
protected WOComponent doSometingAndJumpToAnchor() {
// do something :)
setAnchor("myanchor");
return null;
}
-Kaj :)
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.