You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by Apache Wiki <wi...@apache.org> on 2008/02/08 05:12:30 UTC

[Struts Wiki] Trivial Update of "OpenWindowFromAction" by FrankZammetti

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by FrankZammetti:
http://wiki.apache.org/struts/OpenWindowFromAction

------------------------------------------------------------------------------
  
  Imagine generating this in an Action, where the string "These are my results" is replaced by a full HTML page (properly escaped of course).  Yes, you could generated the response with a JSP, which is what I would recommend.  That might be confusing, so let me explain... a JSP does '''NOT''' have to render a complete HTML document.  It can instead render just a snippet of HTML, or just some Javascript, or just some comma-separated data, there is no limitation.  If you are doing AJAX, whatever is most appropriate can be done via JSPs (like XML too!).  This saved you from writing a lot of println's in your Actions to generate a response.
  
- 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 !AjaxTags 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).
+ 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).
  
  = Takeaway point =