You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew van der Voort <an...@astarte.co.nz> on 2002/03/19 01:42:00 UTC
Moving to an anchor in my JSP page.
One of the pages in my application is a list of students. This list can get
quite large. When a user has finished modifying information about a
particular student (on another page) I would like the list redisplayed
scrolled to the student that was edited.
I have set up the jsp page such that there are <a name="nnn">Bloggs,
Joe</a> entries for each student where nnn is the student id. In my action
class at the point I am ready to return an ActionForward back to the list
page I know the student id I want to go back to in the list.
How do I code the actionforward so that the specified anchor is reached?
This is the same as specifying whatever.html#nnn on the URL or <a
href="whatever.html#nnn> in a page.
I have tried appending #nnn to the path of the ActionForward but this
doesn't work. How do I do this?
Thanks,
Andrew
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Moving to an anchor in my JSP page.
Posted by Jay sissom <js...@toybox.uits.indiana.edu>.
This question was answered on the list last week. I know because I asked
it! George Papandreou answered, and I want to thank him because his
answer worked. My answer is just a little different from his.
In the Action method, I save a string in the request area that has the tag
I want the browser to position to:
request.setAttribute("anchor","#gohere");
In the JSP page, I do this:
<%
String location = (String)request.getAttribute("anchor");
%>
<body onLoad='location.href="<%= location %>";'>
I'm not on the computer with my project, so I don't guarantee it compiles
or works, but it should get you close.
Jay
On Tue, 19 Mar 2002, Andrew van der Voort wrote:
> One of the pages in my application is a list of students. This list can get
> quite large. When a user has finished modifying information about a
> particular student (on another page) I would like the list redisplayed
> scrolled to the student that was edited.
>
> I have set up the jsp page such that there are <a name="nnn">Bloggs,
> Joe</a> entries for each student where nnn is the student id. In my action
> class at the point I am ready to return an ActionForward back to the list
> page I know the student id I want to go back to in the list.
>
> How do I code the actionforward so that the specified anchor is reached?
>
> This is the same as specifying whatever.html#nnn on the URL or <a
> href="whatever.html#nnn> in a page.
>
> I have tried appending #nnn to the path of the ActionForward but this
> doesn't work. How do I do this?
>
> Thanks,
>
> Andrew
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>