This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 4456
    
    6

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: 61066
    
  66

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]
 
Don't get me started about those stupid light bulbs.
 
subject: Anchor target in dispatcher forwards