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???
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.