myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "JavascriptOpenNewWindow" by Rene Grob
Date Mon, 26 Feb 2007 20:18:34 GMT
Dear Wiki user,

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

The following page has been changed by Rene Grob:
http://wiki.apache.org/myfaces/JavascriptOpenNewWindow

------------------------------------------------------------------------------
  However there are two ways to initiate a Javascript call from server side:
   * Create a JSF page containing the script and navigate to that page. (Will not be described
in this tutorial.)
   * Use the Tomahawk's Extestion''''''Filter to inject the Javascript in the rendered page.
(Needs an initial setup but is easier to maintain afterwards.)
- Information about how to setup the Tomahawk's Extestion''''''Filter can be found here:
+ Information about how to setup the Tomahawk's Extestion''''''Filter can be found here: 
  http://myfaces.apache.org/tomahawk/extensionsFilter.html
  
  Now we can inject the Javascript using Tomahawk's Extestion''''''Filter Add''''''Resource
class:
@@ -56, +56 @@

      ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
      String actionUrl = viewHandler.getActionURL(facesContext, viewId);
      
-     String javaScriptText = "window.open('"+actionUrl+"', 'popupWindow', 'dependent=yes,
menubar=no, toolbar=no'); return false;";
+     String javaScriptText = "window.open('"+actionUrl+"', 'popupWindow', 'dependent=yes,
menubar=no, toolbar=no');";
      
      // Add the Javascript to the rendered page's header for immediate execution
      AddResource addResource = AddResourceFactory.getInstance(facesContext);
@@ -83, +83 @@

  public void closeWindowClicked(ActionEvent event) {
      FacesContext facesContext = FacesContext.getCurrentInstance();
  
-     String javaScriptText = "window.close(); return false;";
+     String javaScriptText = "window.close();";
      
      // Add the Javascript to the rendered page's header for immediate execution
      AddResource addResource = AddResourceFactory.getInstance(facesContext);

Mime
View raw message