How to load database values on a JSP page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    #1

    How to load database values on a JSP page

    I'm developing web application using jsp,struts and hibernate. I want to load data base values to dropdownlist. I'm new to struts and hibernet. so i have no idea about how to do that. I have java class and get data using that. Now I want to load that data to dropdown list in another page. How can I do that? please help me.. This is my code in java class.
    Code:
     public ArrayList getdataList (){
             
            try {
                session.beginTransaction();
    
                
                Query q = session.createQuery("from xxx where xxx='" + xxx + "'");
                ArrayList con_list = (ArrayList)q.list();
                return con_list;
            } catch (HibernateException hex) {
                hex.printStackTrace();
                return null;
            }
            
        }
Working...