File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

using a4j:commandbutton to open popup window

ahmed osman

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"
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 = "'"+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 .
I agree. Here's the link:
subject: using a4j:commandbutton to open popup window
It's not a secret anymore!