• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Opening Form Action link on the top of the calling page

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic