gpt4 book ai didi

javascript - 将地理位置 JavaScript 值传递给 Bean

转载 作者:行者123 更新时间:2023-11-30 10:18:36 24 4
gpt4 key购买 nike

<分区>

我必须将通过使用 html5 地理定位获得的地理定位值传递给我的托管 bean ItemMb,这是我的代码来澄清事情,我真的不知道如何实现这一点。

我的托管 bean

public class ItemMb {

private Item item = new Item();

// get/set
}

我的 dto 项目

public class Item {

// private Double idCollect;
// login et password
private Double lat;
private Double lon;
private Double accuracy;
private String photo;
private String remark;

public Item(){
}
// getters and setters

这是我的 .js 文件,我在其中获取了地理位置值并在一些 primefaces 标签中对它们进行了 innertext

window.watchID = navigator.geolocation.watchPosition(function(position){              

document.getElementById("xCurrentPosition").innerHTML = (Math.round(position.coords.latitude*100) / 100);
document.getElementById("yCurrentPosition").innerHTML = (Math.round(position.coords.longitude*100) / 100);
document.getElementById("accuracyCurrentPosition").innerHTML = position.coords.accuracy;

});

现在我想将那些 JavaScript 生成的地理位置值传递到我的托管 bean ItemMb。如果您需要更多信息,请随时询问。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com