aspose file tools*
The moose likes JSP and the fly likes javascript and jsp forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

javascript and jsp forward

Sree Lakshmi Sugunan
Greenhorn

Joined: Feb 29, 2008
Posts: 23
Hi,

From a jsp page I need to forward to another page. Also I need to open another window using the function window.open

called from a javascript func

function popup()
{

window.open("<%=url%>", "tinyWindow", "toolbar=1,width=150,height=100");
}

Will I be able to acheive both?

I am calling the script on load but by that time the forward is already done and control doesnt goes to the script. Is there a way to run both? There is no restriction on when the script can be run. Any time is ok. But I dont get any funtions that run the script before the load of the page.


I put the jspforward inside the script, the forward happens but the window doesnt open.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

It's very unusual to forward from one JSP to another. Are you sure that it is a forward that you are doing? If so, why?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ray Carrender
Greenhorn

Joined: Aug 12, 2008
Posts: 12
First, I'm going to pose a few questions; why are you forwarding from one JSP to another instead of JSP to Servlet or just posting a form that sends data to the servlet.

Secondly, how is the forward being called? Is it with an ajax script (like by DWR) if so, add the window popup to the callback function.

Ray
Sree Lakshmi Sugunan
Greenhorn

Joined: Feb 29, 2008
Posts: 23
Hi

I am sorry for the wrong description. The forward is to another servlet only. I have a parent submit jsp from where I submit to a servlet(to generate a report). From this servlet if the report type is pdf(content type is pdf), I forward to a intermediate jsp. The purpose of this jsp is to set certain headers and add the javascript content to html(this isto create a webtrend log req an image to server onload of page.). After running this script, I forward it to another servlet to write back the pdf response.

The issue is I cant write to the client before the forward. So I thought of opening a new explorer using a script and run the add javascript through that browser so that the intermediate jsp can go ahead with the forward.

First of all I am not sure if this works because when I try, I invoke the script onload but the control goes to the servlet with the forward and doesnt reach the script. If forward is there cant we do any thing else in the page to send to client


I had another post also for a another issue of this problem (Generate PDF report from jsp) which has more details of the issue.

Thanks in Advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

Originally posted by Sree Lakshmi Sugunan:
I had another post also for a another issue of this problem (Generate PDF report from jsp) which has more details of the issue.
Ah yes, I though this sounded familiar. Did you understand Ulf's solution to your issue in that topic?

I'm going to close this topic and we can continue to discuss this in the original topic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript and jsp forward