jQuery in Action, 3rd edition
The moose likes Struts and the fly likes streaming an HTML document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "streaming an HTML document" Watch "streaming an HTML document" New topic

streaming an HTML document

john alexa

Joined: Nov 15, 2011
Posts: 4
hows it going everyone... i have quite the issue here... it seems simple enough but it has me stumped.

i have a document repository.... people can upload files into it, then click on the file name to view it.....

however, in the case that the user selects an HTML document i am running into some trouble:

it is opening on top of my current application, i have tried target="_blank" etc, etc... but the best ive gotten was for it to open a new blank page...

what i would like to happen is to simply have a new window pop up with the desired HTML document shown....

here is the code in the jsp:

<li <a class="docTree" onclick="document.documentTreeForm.filePath.value='" + currentID + "'; document.documentTreeForm.fileContent.value='" + currentFile.replace("'", "\\'") + "'; document.documentTreeForm.submitAction.value='viewFile'; document.documentTreeForm.submit();" target="" href="javascript: void(0);">" + currentFile + "</a></li>

i pass that into my action which locates the file within my database and sends the data to the following class to stream: (mind you, this works for every other type of document, and i dont have the exact path/location of the HTML document... so this is the only way i can retrieve the data)

if anyone has any help or hints im open to anything!

thanks a lot,
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

Your HTML is malformed. The <li is missing its >. (In fact, it looks like you just cut it out of some script?)

What are the content-type and content-disposition headers begin set to?

[Asking smart questions] [About Bear] [Books by Bear]
john alexa

Joined: Nov 15, 2011
Posts: 4

my JSP code is actually fine, i just was trying to cut out some unneeded portions for my question and edited it poorly... and as you pointed out... i also forgot another chunk of code:

as you can see above.. i started off attempting to grab the file type but that didnt work any better, so for now everything gets the same content type.

*i should note, that this is only an issue for me in IE, firefox handles it differently.

thanks for your help!
I agree. Here's the link: http://aspose.com/file-tools
subject: streaming an HTML document
jQuery in Action, 3rd edition