converted to 1.6 markup
|No differences found!|
How to open a new window from an Action
Another frequent question on the mailing lists is how to open a new browser window from an Action. This one won't take too long:
Strictly-speaking, this is true... code running on the server has no way to tell the browser to open the response in a new window. That being said, there ARE a couple of ways to get the desired effect.
s = ""; s += "<html><head><title>Results</title></head><body>"; s += "These are my results"; s += "</body></html>"; w = window.open("", "Results", "resizable,height=200,width=200"); w.document.open(); w.document.write(s); w.document.close();
Now, if you make an AJAX call to this Action, and return this content and execute it, you will get your response opened in a new window. Neat, huh?!? If you decide to go this route, I suggest checking out the AjaxParts Taglib in the Java Web Parts project (http://javawebparts.sourceforge.net). It will allow you to put a single custom tag on your page and save you from having to write the AJAX code or the code to execute the returned results (although you will still have to write the code in the Action).