خرید بک لینک

Vote count: 0

I'm trying this for get the id user and display in a jsp :

  public int getId(String user){
    Statement st = null;
    ResultSet rs = null;
    try{
        st = getConexion().createStatement();
        String consulta = "select idperson from person where nombre='"+user+"'";
        rs = st.executeQuery(consult);
        if(rs.next()){
             int id = rs.getInt("idperson");
             retu id;
        }
    }catch(Exception e)
    {
        System.err.println("error: "+e);
    }
}

This is my code from the jsp:

<%
HttpSession objsesion = request.getSession(false);
String user=  (String)objsesion.getAttribute("name");
%>

Then call my function:

<%Consult iduser = new Consult(); 
        iduser.getId(user);%>

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 8 مرداد 1395 ساعت: 22:41

صفحه بندی