It's not a secret anymore!*
The moose likes Other Open Source Projects and the fly likes using a4j:commandbutton to open popup window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "using a4j:commandbutton to open popup window" Watch "using a4j:commandbutton to open popup window" New topic
Author

using a4j:commandbutton to open popup window

ahmed osman
Greenhorn

Joined: May 28, 2008
Posts: 5
hi every one .

i have this problem :

when i use a4j:commandbutton to open popup window nothing works , when i changed it to h:commandbutton it works fine .

this is part of jsp file :

<a4j:commandButton tabindex="140" id="iddfa157"
value="#{msg.Cash_Button4}"
styleClass="Button"
status="statusbutt"
reRender="cdt13"
action="#{deposit.addTransaction}" />


i inject javascript from java bean like this :

public void printVoucherPopup(String option) {
// View's id in the same form as used in the navigation rules in faces-config.xml
// This value could be passed as parameter (using <f:param>)


String viewId = "/blank.jsf" ;

if (option.equals("CashDp")){
viewId = "/DepostAdvice.jsf" ;
}

FacesContext facesContext = FacesContext.getCurrentInstance();

// This is the proper way to get the view's url
ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
String actionUrl = viewHandler.getActionURL(facesContext, viewId);

System.out.println("url :"+actionUrl);

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);
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);

}

can any one tel me what the problem .
 
GeeCON Prague 2014
 
subject: using a4j:commandbutton to open popup window