• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using a4j:commandbutton to open popup window

 
ahmed osman
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic