I'm preparing some variables in JavaScript (in my specific case, I'd like to get GPS location):
function getVars() {
// ...
var x = locationInfo.lng;
var y = locationInfo.lat;
}
I'd like to send them to my managed bean via the below command button:
<h:commandButton value="submit" onclick="getVars()" action="#{bean.submit(x,y)}" />
public void submit(int x, int y) {
// ...
}
How can I send x
and y
variables from JavaScript to JSF managed bean action method?