| Author |
redirect to another page (not the beggining)
|
Lucas Grijander
Greenhorn
Joined: Feb 10, 2009
Posts: 9
|
|
Hi guys:
I was wondering if any of you knows how to redirect to another page of the web application (well this is simple)
The problem I have is: I don“t want to display that page from the beggining, but from, lets say, a different intermediate point.
Thanks in advance!
|
 |
Lucas Grijander
Greenhorn
Joined: Feb 10, 2009
Posts: 9
|
|
Well I have thought how to do it: using anchors, a request variable with the name of the appropriate anchor and javascript in the jsp checking if the variable is not null or empty; in this case use javascript to focus on the suitable anchor...
What I want is if anybody can help me with some CODE!!!
thanks!
|
 |
Lucas Grijander
Greenhorn
Joined: Feb 10, 2009
Posts: 9
|
|
something like this:
In the Action, I set:
request.setAttribute( "anchor", "nameOfAnchor");
Then at the bottom of the JSP (so it won't execute until the page has
finished loading) I have:
<c:if test="${anchor ne null}">
<script>
document.location = "#<cut value="${anchor}"/>";
</script>
</c:if>
I dont know how to set an anchor in a jsp to reference it from my javascript code...
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Then at the bottom of the JSP (so it won't execute until the page has
finished loading) I have:
Hmm - this sounds a little suspect. Putting JavaScript at the base of a page doesn't determine when it will be run. You should use an event.
Also, I'm not following why you would do this in JavaScript. Can you explain?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
 |
|
|
subject: redirect to another page (not the beggining)
|
|
|