jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes Anchor target in dispatcher forwards Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Anchor target in dispatcher forwards" Watch "Anchor target in dispatcher forwards" New topic
Author

Anchor target in dispatcher forwards

Mary White
Ranch Hand

Joined: Jan 27, 2003
Posts: 41
Hi,
I'm trying to use anchor targets in the <forward> tag of and <action> in the struts-config.xml.
I using the following approach:
<forward name="success" path="/client/ClientInfo.jsp#details" redirect="true"/>
Although the page is presented, the anchor target is ignored.
I already tried accessing the page directly from the browser address and the anchor target works fine. It's only ignored when I try to access it from the struts-config file.
Any Idea?
Thanks
[ October 21, 2003: Message edited by: Bear Bibeault ]
Terry Martinson
Ranch Hand

Joined: Oct 18, 2003
Posts: 293
I'm trying to do a similar thing and also can't get this to work. I tried building a new ActionForward by appending on the anchor tag in an action class, but that also does not work.
In the depths of the Struts RequestProcessor code, they use a RequestDispatcher to do the actual forwarding. The API for RequestDispatcher says that it "sends them to any resource (such as a servlet, HTML file, or JSP file) on the server". So, it looks like whatever path the ActionForward is sent to is the actual file name destination. (i.e. If ActionForward path is "/someplace/foo/Bar.jsp#MyAnchor", the RequestDispatcher will actually look for that filename, including the #MyAnchor, on the server.) I proved this out by putting an actual file name including the anchor out there, and it does find it.
Has anyone figured out a way to deal with anchors in the Struts framework?
TJ


SCJP, SCJD, SCWCD, SCBCD
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

This is actually JSP-related, not Struts-related. Here's a solution: http://www-level3.experts-exchange.com/Programming/Q_20683436.html
Moving this thread to the JSP forum.


Junilu - [How to Ask Questions] [How to Answer Questions]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

I also modified the subject to make it easier for future searchers to find.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anchor target in dispatcher forwards
 
Similar Threads
problem integrating tag libraries with struts application.
How to forward to jsp page and then jump to anchor of the page
xsl: anchor problem
Problem in request forwarding
Anchor in Jsp:forward