• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Displaying a HTML file in the new Browser Window using JSP

 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I require to have a JSP page, which would be able to display an HTML file in another browser window.This JSP page would be able to access the HTML files of the system, which may not necessarily be mapped to the same web server.
Hence I need to:

  1. Access the path information of the file
  2. Read the File through InputStreams
  3. Write it using the Outputstream in the new Browser window

  4. We may consider click of a link of a file which would get the file information and display it in a new Browser window
    Is this possible through JSP?
    Thanks in advance.
    Regards,
    ------------------
    Sandeep Desai
    [email protected]

    1. Sun Certified Java Programmer Scored 93 per cent
    2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
    3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
    4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
One of the simplest ways would be to Read the file and write it out to a web-accessible location. Then spawn a new window (using javascript) pointing to this location.
Alternatively, you will have to use a Jsp page (/servlet) exclusively for the {read file, write file to outstream}
Jsp #1 or even a static HTML page (depends on your needs)

filewriter.jsp

But, the above method needs 2 requests to the server. One for getting the main page (jsp/html) and the other to load the content in a new browser window.
Hope this helps.
Ashwin.
[This message has been edited by Ashwin Desai (edited April 27, 2001).]
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ashwin,
Is there any way we can open a new browser window through JSP?
Thank you for your views.
Regards,

------------------
Sandeep Desai
[email protected]

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The answer is yes and no.
Opening a new browser is something that takes place entirely on the client. This is the realm of JavaScripting.
JSP can dynamically generate Javascript (or pretty much anything) and this scripting can open a new window.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic