My application manages the software, and for the convenience of users, I want to allow them to open several tabs to change the settings of more than one record at a time. But, having finished everything that they do, the tabs remain open, and I received some complaints about this. So basically my question is:
If there is a way to close a browser tab that sends a request to a method in my bean support? eg:
JSF Page:
<h:commandButton value="Public score"
action="#{assignmentBean.publicSelected()}">
</h:commandButton>
Bean Method:
public void publicSelected() {
application.setAssignmentStatus(done);
dataAccess.mergeEntity(application);
}
Is there a way to add something after merging the command and close the browser tab that activated the method? thanks for the help
FULL CODE FOR SOLUTION . I am poorly versed in JS and JSF, so for any of you who are also bad at this, I am posting the full code using the Tiago Vieira Dos Santos hint.
:
<h:commandButton value="Public score"
action="#{myBean.doThings}">
<f:ajax execute="@this" onevent="pop"/>
</h:commandButton>
:
<script type="text/javascript">
function pop(data){
if(data.status == "success"){
window.close();
}
}
</script>
, , , .