Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anchor target in dispatcher forwards

 
Mary White
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Junilu Lacar
Bartender
Pie
Posts: 7317
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also modified the subject to make it easier for future searchers to find.
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic