After calling the javascript function by clicking on logout p:remotecommand
is not executing.
This is my XHTML code:
<script type="text/javascript">
function logoutAccount() {
debugger;
var txt = "eeeeeeeeeeeeeee";
command([{name:'param',value:txt}]); //This is important
}
</script>
<a href="#" onclick="logoutAccount()"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
<p:remoteCommand name="command" action="#{MyiaTaskBean.method}" />
This is my code in Java bean:
public void method() {
String value = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param");
System.out.print("value is::::::::::::::::::::::"+value);
}
I tried to change action by action listener but it didn't work.
p:remoteCommand
needs to be inside form.Below code works in my environmet (you haven't said what JSF/PF version you're using):
With your java code the result is: