Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Opening Form Action link on the top of the calling page  RSS feed

 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java Class, which has a Java Script function which makes an HTML form and then submits it to an action URL. I want to ensure that the URL always open on the top of my calling window. As of now, some times it is displaying behind the calling page.

I am using internet Explorer IE 7.0
The Code is as follows Class 1:
********************************************************



The URL "strServerURL" is a Servlet: and it reders out a PDF Document to the User, which is displayed within the IE
The Following servlet is called, after the above class is executed.
Servlet 2:
*************************************************************************
ServletOutputStream outStream=response.getOutputStream();
FileInputStream inStream = new FileInputStream(pdf);
BufferedInputStream inBuf = new BufferedInputStream(inStream);

/*Send output file to Client*/
/*Display PDF in the browser*/
response.setContentType("application/pdf");
response.setHeader("content-disposition","inline; filename=output.pdf");

/*Display PDF in Acrobat/Reader */


response.setContentLength((int)pdf.length());

int readByte=0;
while((readByte=inBuf.read())!=-1){

outStream.write(readByte);
}

//Cleanup temporary files
inStream.close();
outStream.close();
*******************************************************

What should I do to make sure that PDF is always displayed in front of the calling screen and not behind.

 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
You may want to try this w3schools help page..

Moreover, you should not write this kind of code in the Servlet or Java Class. JSPs are meant to do all of this.
That way you can have more readable and maintainable codebase.

Regards,
Amit
 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Amit,

We have tried the focus function, but it seems it does not work all the time. if there a way to do some focusing when we flushing the content as PDF on the servlet side?

I would like to correct my information on our enviornment, we are using IE 8.0 and not IE 7.0 (As I had mention earlier) and Acrobat Reader X

Thanks
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!