aspose file tools*
The moose likes Struts and the fly likes redirect to another page (not the beggining) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "redirect to another page (not the beggining)" Watch "redirect to another page (not the beggining)" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: redirect to another page (not the beggining)
 
Similar Threads
RequestDispatcher
JSP redirect
Servlet to html
redirect in a filter class
how to redirect from a single servlet to more than one jsp's?