fmz galera ? eu preciso exibir algumas imagens (só ta o caminho dela do banco) … se for possivel sem o uso de ajax
vou postar o q eu fiz:
<f:view>
<h:form>
<h:dataTable value="#{Banco.caminho}" var=“perfis”>
<h:column >
<f:facet name=“header”>
<h:outputText value=“Imagem” />
</f:facet>
<h:graphicImage url="#{perfis.caminho}" value="#{perfis.caminho}" width=“200” height=“200” />
</h:column>
</h:dataTable>
</h:form>
</f:view>
public class Imagems {
private Integer id;
private String foto;
private String caminho;
/** Creates a new instance of Imagem */
public Imagems() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
public String getCaminho() {
return caminho;
}
public void setCaminho(String caminho) {
this.caminho = caminho;
}
}
public List getCaminho() {
ArrayList<Imagems> lista = new ArrayList<Imagems>();
try {
stm = con.createStatement();
String sql="SELECT id,nome,imagem FROM imagems";
rs = stm.executeQuery(sql);
int i=0;
while(rs.next()){
if (i<10){
Imagems p = new Imagems();
p.setId(rs.getInt(1));
p.setFoto(rs.getString(2));
p.setCaminho(rs.getString(3));
lista.add(p);
i++;
}
}
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
return lista;
}
valeu galera…
aproveitando…se alguem souber como fazer para carregar uma imagem me fale…
valeu !!!