window closing javascript in javabean reporting error
Hi,
i want to closed jsf page on button clicked, i am using the that code in javabean my code is like this.
public void closeWindowClicked(ActionEvent event) {
try
{
FacesContext facesContext = FacesContext.getCurrentInstance();
String javaScriptText = "window.close();";
// Add the Javascript to the rendered page's header for immediate execution
AddResource addResource = AddResourceFactory.getInstance(facesContext);
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);
}
catch(Exception e)
{
System.out.println(""+e);
}
}
i am getting this error .->
Exception while invoking expression #{tanishqBean.closeWindowClicked}
i want to keep that javascript code into method only becoz i want to perform two task on clicking of single button.
can any one help me.
thanks

