atom feed2 messages in org.apache.struts.userRe: forwarding with an anchor directive
FromSent OnAttachments
troy hartJul 6, 2001 10:18 am 
Craig R. McClanahanJul 17, 2001 11:08 am 
Subject:Re: forwarding with an anchor directive
From:Craig R. McClanahan (crai@apache.org)
Date:Jul 17, 2001 11:08:53 am
List:org.apache.struts.user

On Fri, 6 Jul 2001, troy hart wrote:

I have a situation in which I need to forward to a certain place with a form (i.e. I need to reference an anchor in my href...). I can code my action class to determine what the anchor needs to be, but I'm at a loss for how I would get the ActionForward to include the anchor...

I could maybe do something like: myActionForward.setPath(myActionForward.getPath() + "myAnchor");

It would have to be "#myAnchor" instead, so that you get the "#" character that marks the anchor.

But then I believe the path would be tainted for subsequent requests that need to use that ActionForward....

Has anyone dealt with this issue before???

Thanks,

Troy

You cannot forward to an anchor. You can only redirect to an anchor.

The reason for this is that anchors are interpreted by the client, not the server. Doing a forward passes the URL to the server, but *not* back to the client (note that the location bar in the browser doesn't change), so the browser will never see it.

Craig