Ajax 如何正确更新表单中的组件
我的表格中有一堆显示图像的面板,但我有一个问题,就是要更新图像,只需单击一个按钮即可加载下一组图像。我尝试过使用ajax=false方法,但这会删除表单e.g中的所有变量用于加载图像的URL这是我的按钮:Ajax 如何正确更新表单中的组件,ajax,jsf,primefaces,Ajax,Jsf,Primefaces,我的表格中有一堆显示图像的面板,但我有一个问题,就是要更新图像,只需单击一个按钮即可加载下一组图像。我尝试过使用ajax=false方法,但这会删除表单e.g中的所有变量用于加载图像的URL这是我的按钮: <div style="position : absolute; right:400px; top:1500px" > <p:commandButton value="Confirm" id="Confirm" actionListener="#{con.confi
<div style="position : absolute; right:400px; top:1500px" >
<p:commandButton value="Confirm" id="Confirm" actionListener="#{con.confirmButton}" oncomplete="PF('panelP').hide()" ajax="false" />
</div>
面板和确认按钮以如下形式存储:
<h:form id="form">
<p:galleria id= "ISSimage" style="position : absolute; left:50px; top:550px" value="#{con.gallery}" var="image" panelWidth="500" panelHeight="313" showCaption="true">
<p:graphicImage value="#{image}" alt="Image Description for #{image}" title="#{image}"/>
</p:galleria>
<f:view contentType="text/html">
<p:panel id="satImage" style="position : absolute; right:50px; top:550px" panelWidth="500" panelHeight="400">
<p:gmap id="satview" center="#{con.lati}, #{con.longi}" zoom="6" type="SATELLITE" style="width:600px;height:400px" model="#{con.simpleModel}" />
</p:panel>
</f:view>
我尝试存储所有图像的列表
是否有一种方法可以在不删除图像变量的情况下,通过单击确认按钮正确加载下一组图像
我的BEAN有300行,所以我只限于显示相关部分。这是:
公共无效确认按钮actionEvent{
//setting Next Image
//add the point depending on which panels are open then reset the panel booelan values
gallery = new ArrayList<String>();
candidates = new ArrayList<String>();
Connection conn = null;
PreparedStatement stmt = null;
//Statement stmt1 = null;
ResultSet rs = null;
//gallery.clear();
try{
gallery = new ArrayList<String>();
conn = DriverManager.getConnection(CONN_STRING,USERNAME,PASSWORD);
stmt = conn.prepareStatement(op);
//stmt.setString(1, oldconsole);
//stmt.setString(2, oldconsole);
stmt.setDouble(1, oldlati);
stmt.executeUpdate();
stmt = conn.prepareStatement("SELECT * FROM `ISS` WHERE taskinfo__citylat = (SELECT taskinfo__citylat FROM `ISS` LIMIT ?,1)");
int rdmnum = randomise();
stmt.setInt(1, rdmnum);
rs = stmt.executeQuery();
while(rs.next()){
String issimg=rs.getString("taskinfo__link_small");
gallery.add(issimg);
//ADDS IMAGES TO GALLERIA
excl_num = rs.getInt("rownum");
excluded.add(excl_num);
//ADDS ROWNUMBERS TO EXCLUDED ARRAY SO THEY DONT GET CALLED AGAIN.
lati = rs.getFloat("taskinfo__citylat");
longi = rs.getFloat("taskinfo__citylon");
oldlati=lati;
}
catch(SQLException e){
System.err.println(e);
}
public float getLati(){
return lati;
}
public float getLongi(){
return longi;
}
public double getOldlati(){
return oldlati;
}
public double getOldlongi(){
return oldlongi;
}
这似乎是JavaScript,而不是Java。如果您使用正确的标记,它将改进您获得良好帮助的更改。请添加您的bean并阅读如何创建。您的bean的作用域是什么?将图像加载到panelits@Sessionscoped中