Hi All,
I am trying to pass a javascript variable to the backing bean through pe:remotecommand with a single String parameter.
Problem is that on the backend I receive [Object object] (what is that by the way?) instead of the actual String parameter.
What am I doing wrong?
Code snippets:
XHTML + JS:
<h:body onload="function storeWindowID() {
if (window.name === ' ') {
window.name = Math.floor(Math.random() * Math.floor(100)).toString();
}
sendWindowID([{name: 'windowId', value: window.name}]);
} storeWindowID()">
<h:form>
<pe:remoteCommand name="sendWindowID" process="@this" actionListener="#{artifactDetailsBean.setWindowId}">
<pe:methodSignature parameters="java.lang.String"/>
<pe:methodParam name="windowId" />
</pe:remoteCommand>
</h:form>
Java:
@Named
@SessionScoped
public class ArtifactDetailsBean {
private String windowId;
public String getWindowId() {
return windowId;
}
public void setWindowId(String windowId) {
this.windowId = windowId;
}
// etc.
}
Thanks upfront for any help!
pe:methodparam conversion problem
I think your problem might be because you are doing it OnLoad. I bet the onLoad is being called before the remote command is set up?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4
Hmm the documentation example here: https://www.primefaces.org/showcase-ext ... dParam.jsf
Just shows it calling...
Which is normal Javscript calling it with 3 params? So I would expect your "sendWindowID(window.name)" is correct just passing it one param.
Just shows it calling...
Code: Select all
onclick="applyData('hello user', '7/11/01 11:55:42 PM', JSON.stringify(circle2))"
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests