Quantcast
Channel: BTSoru.com - Bilisim ve Yazilim Teknolojileri Soru/Cevap Platformu - latest questions
Viewing all articles
Browse latest Browse all 4270

Primefaces select sorgusu gelmiyor

$
0
0

Merhaba kisiler adında bır tablom var bu tablodakı verılerı datatable çekmek için aşagıdaki gibi bir şey yeazdım ama tablodaki veriler hala gelmiyor sizce neden?Şimdiden teşekkürler POJO


public class Pojo {

int ID;
String AD;
String SOYAD;
int YAS;
String CINSIYET;

public int getID() {
    return ID;
}

public void setID(int ID) {
    this.ID = ID;
}

public String getAD() {
    return AD;
}

public void setAD(String AD) {
    this.AD = AD;
}

public String getSOYAD() {
    return SOYAD;
}

public void setSOYAD(String SOYAD) {
    this.SOYAD = SOYAD;
}

public int getYAS() {
    return YAS;
}

public void setYAS(int YAS) {
    this.YAS = YAS;
}

public String getCINSIYET() {
    return CINSIYET;
}

public void setCINSIYET(String CINSIYET) {
    this.CINSIYET = CINSIYET;
}

public Pojo(int ID, String AD, String SOYAD, int YAS, String CINSIYET) {
    this.ID = ID;
    this.AD = AD;
    this.SOYAD = SOYAD;
    this.YAS = YAS;
    this.CINSIYET = CINSIYET;
}

public Pojo() {
}

}

Control

@ManagedBean public class Bean {

Connection conn = null;
public List<Pojo> kisiler = new ArrayList<Pojo>();

public Bean() {
    System.out.println("--------------------------------connection acti");
    try {
        System.out.println("--------------------------------connection acti");
        conn = DriverManager.getConnection("jdbc:oracle:thin:@10.0.0.199:1521:CLOUD", "mustafa", "mustafa");
        Statement sqlSelect = conn.createStatement();
        ResultSet rs = sqlSelect.executeQuery("SELECT * FROM KISILER");
        while (rs.next()) {
            kisiler.add(new Pojo(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getInt(4), rs.getString(4)));
            System.out.println(rs.getInt(1));
        }
    } catch (SQLException ex) {
        Logger.getLogger(Bean.class.getName()).log(Level.SEVERE, null, ex);
    }
}

public List<Pojo> getKisiler() {
    return kisiler;
}

public void setKisiler(List<Pojo> kisiler) {
    this.kisiler = kisiler;
}

}

welcomePrimefaces.xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">

<f:view contentType="text/html">
    <h:head>
        <f:facet name="first">
            <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
            <title>PrimeFaces</title>
        </f:facet>
    </h:head>
    <h:body>
        <p:dataTable var="data" value="#{bean.kisiler}" style="width:600px">
            <p:column headerText="ID">
                <h:outputText value="#{data.ID}" />
            </p:column>

            <p:column headerText="AD">
                <h:outputText value="#{data.AD}" />
            </p:column>

            <p:column headerText="SOYAD">
                <h:outputText value="#{data.SOYAD}" />
            </p:column>

            <p:column headerText="YAS">
                <h:outputText value="#{data.YAS}" />
            </p:column>

            <p:column headerText="CINSIYET">
                <h:outputText value="#{data.CINSIYET}" />
            </p:column>
        </p:dataTable>
    </h:body>
</f:view>

</html>

web.xml

<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee &lt;a href=" http:="" xmlns.jcp.org="" xml="" ns="" javaee="" web-app_3_1.xsd"="">">http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>faces/welcomePrimefaces.xhtml</welcome-file> </welcome-file-list> </web-app>


Database

CREATE TABLE "MUSTAFA"."KISILER" ( "ID" NUMBER(,0), "AD" VARCHAR2(45 BYTE) NOT NULL ENABLE, "SOYAD" VARCHAR2(45 BYTE) NOT NULL ENABLE, "YAS" NUMBER(,0) NOT NULL ENABLE, "CINSIYET" CHAR(1 BYTE) NOT NULL ENABLE, PRIMARY KEY ("ID") )


Viewing all articles
Browse latest Browse all 4270

Trending Articles


huddam daveti


Tekasür Suresi


"Yâ Kuddûs!" Esması Havâs ve Esrârı


Kasemi Mübelliğa


Peri44


Kuvvetli muhabbet ve aşk tılsımı


El-Mütekebbir


Papaz büyüsü


SCCM 2012 Client Installation issue


Zilhicce Ayının Namaz Duası ÖNEMLİ