I have this function in ManageBean
class :
public String myname()
{
return employeeManagedBean.I().getUser_name();
}
I want to call this function in a JavaScript function and catch the returned value from Myname
function. I tried this :
<h:form>
<p:remoteCommand name="myname" actionListener="#{employeeManagedBean.myname()}" />
<script type="text/javascript">
function handleMessage() {
var m = myname();
console.log(m);
}
</script>
</h:form>
but the value of m
that printed in the console was undefined
.
Is there any way to do that ?