Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

redirect to another page (not the beggining)

 
Lucas Grijander
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic