my dog learned polymorphism*
The moose likes JSP and the fly likes Problem with anchor tag # when trying to open pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with anchor tag # when trying to open pdf " Watch "Problem with anchor tag # when trying to open pdf " New topic
Author

Problem with anchor tag # when trying to open pdf

vamshidhar nimbagiri
Ranch Hand

Joined: Oct 04, 2004
Posts: 61
Hi All,

I have a requirement to open a PDF document (to open an existing pdf on server not creating) with showing the appropriate section which user clicked and also need to update the count in database.

In order to do this i have followed these steps:
Ex: Lets say XYZ.pdf file which has a, b and c sections. To show section a in the URL it is some thing like ../../XYZ.pdf#a


1. First, i called my controller class when user clicks the link (to update the count in database) and in controller i used Spring MVC redirect function to open XYZ.pdf#a. But the problem is its removing the # from URL and showing entire XYZ.pdf opening first page instead of showing #a section. That too this is happening in IE browser not in Firefox.
2. I have tried another way by calling a dummy jsp from controller and onload of that jsp i did location.href function to show the pdf document. It worked but the problem is with back button, if i use POST method back button displays page cannot be displayed message, if use GET method back is not working i will be in same page forever it wont allow you to go back.

I hope i cleared explained my problem, Could any one please help me.

Thanks in advance!

- Vamshidhar Nimbagiri


Thanks,
Vamshidhar Nimbagiri
SCJP 5.0
vamshidhar nimbagiri
Ranch Hand

Joined: Oct 04, 2004
Posts: 61
Hi All,

After trying many alternative solutions. At last i found one which is working.

In my controller i setting the location to response header like this:

response.setStatus(Response.SC_MOVED_TEMPORARILY);
response.setHeader("Location", docLoc); // where docLoc is the absolute path of the location of the document.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with anchor tag # when trying to open pdf
 
Similar Threads
object doesn't support the property or method
REFRESH A JSP PAGE
Refresher Database Value
Advise if I am in correct direction
In jQuery, slideUp a div at initialization