Win a copy of Learn Spring Security (video course) this week in the Spring forum!
    Bookmark Topic Watch Topic
  • New Topic

javascript and jsp forward

 
Sree Lakshmi Sugunan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
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?
 
Ray Carrender
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic