struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Piker" <>
Subject RE: Struts ActionForward to HTML <A NAME="xxx"> anchor
Date Fri, 11 Mar 2005 21:56:09 GMT
I don't think you can do it quite in the manner that you're attempting,
but you can achieve this behavior by doing the following:

- in your action class, populate a request attribute when this page
refresh occurs 
- forward back to your jsp as normal
- in your jsp, check for the existence of this request attribute.
- if it exists, call a javascript function that sets the
window.location.hash value to your anchor name.

- Scott

-----Original Message-----
From: Brian Bezanson [] 
Sent: Friday, March 11, 2005 4:42 PM
Subject: Struts ActionForward to HTML <A NAME="xxx"> anchor

I'd like to know if it is possible to get a ActionForward to scroll my
target page to an anchor on the page created with the <a

Problem Description
I have a page in struts (rather large form) where I have a drop-down
menu near the bottom with some choices. (AKA html:select and

When a user selects from that menu, I have a javascript.submit() that
occurs where my page action retrieves data based on the menu change and
populates another text block on the page below the pop-up. On the page
being 'refreshed' it has set the scroll position to the top of the page
-- which is the normal behavior.

I'd like to return to a named anchor on the page by the drop-down menu.
My code returns a "return

In my struts-config.xml I also have the following: "<forward
name="myMessage" path="/Main/SomePage.jsp#name_reference"/>"

In the JSP page (SomePage.jsp) I have:

<html:link linkName="name_reference"></html:link>

But of course when I try and execute things, I get a 404 error::

	HTTP Status 404 - /Main/SomePage.jsp#name_reference
	type Status report
	message /Main/SomePage.jsp#name_reference
	description The requested resource
(/Main/SomePage.jsp#name_reference) is not available.
	Apache Tomcat/5.0.28

Removing the #name_reference from the struts-config.xml file gets things
working again -- just no scrolling to my anchor point.

Thanks in advance,


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message