Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

WebObjects/Web Applications/Development/Examples/Anchors

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Put the following in the superclass for your 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 you just put in 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; }