Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread David Johnson
Hey all is it possible to forme my struts app to open up a second browser window for the purpose of streaming a different content type (like a pdf file) into it while maintaining the page in the original browser? Essentially, I have a nicely rendered HTML report in browser a and when the user

RE: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Benedict, Paul C
David, You could have your response return HTML with rendered JavaScript; the script would then automatically pop open a new window with the destination link that generates your unstructured content. You could even provide a link in the response if the JavaScript doesn't run automatically.

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread David Johnson
hmm I dont think I understand. so instead of redirecting to an action mapping, just add the HTML myself, like you would if you were writing a servlet (no jsp) application? interesting. you're right, I dont need a nice tiles definition page for my pdf/xls output.. all I really need is to pop up

RE: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Benedict, Paul C
David, You cannot control opening a new client window from a server response. This is all client-side control -- javascript for the user explicitly opens a link in a new window. Because of this limitation, you need to work with the client-side support that you may have control over: JavaScript.

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Frank W. Zammetti
You said: Essentially, I have a nicely rendered HTML report in browser a and when the user clicks export to PDF or export to excel I want a NEW browser to pop up into which I will send the response with the headerType set to the appropriate type. Without an applet or ActiveX control or something

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Aladin Alaily
Hi Dave, This is pretty straightforward. In browser a, you have a button that says: Export to PDF The code would look like this: html:form action=/exportToPdf.do target=_NEW submit name=export value=Export to PDF /html When the user clicks on the button, the action exportToPdf.do opens an

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread David Johnson
A, gotcha. it's an internal app thankfully, and they're fine with javascript. The report itself foesnt exist when the page is sitting there rendered. the action is going to render it.. a Call to SAS specifically, --

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread David Johnson
whoa that's simple. I'm trying that first Thanks One things though, I'll have to set the target conditionally, only when the user clicks PDF or EXCEL since I dont **always** want it opening a new window... function setTarget(target) { document.forms[0].target=target; } On 5/12/05, Aladin

RE: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Benedict, Paul C
David, Aladin has a more straight forward approach. If you can know ahead of time when you need to open a new window, take his approach; if you have no prior knowledge, you'll need to send back JavaScript to open a new window. Either way should fit the bill. Thanks, Paul -Original

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Frank W. Zammetti
Ugh, I always forget the simple target attribute! Absolutely agreed, that's probably the best approach. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, May 12, 2005 11:16 am, David Johnson said: whoa that's simple. I'm trying that

RE: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Benedict, Paul C
Return null. Returning null means you have handled the response and Struts will do no more. -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 5:47 PM To: Frank W. Zammetti; Struts Users Mailing List Subject: Re: Opening a NEW browser for a 2nd

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread David Johnson
Wow, excellent. Thanks! is tehre anything IU need to do to close my PrintWriter in the Action class? right now I have response.setContentType(application/pdf); response.setHeader(Content-disposition, inline ); PrintWriter out = response.getWriter(); socket.write(out); // I get my PDF through

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Frank W. Zammetti
Return null. That's it (seriously!) Null effectively means do not forward to anything, the response is completely formed. Frank David Johnson wrote: Okay, I've got it opening the second browser (finally got back to it) using the target=_new in the form declaration, but here's the real problem

Re: Opening a NEW browser for a 2nd content type from an action

2005-05-12 Thread Frank W. Zammetti
As a general rule you always want to close any stream when done, unless you know by design that you need it to remain open, so yes, you probably want to close it. That being said, I've seen *PLENTY* of code that does things like this that don't close the stream, and as far as I could tell it