Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<Application> getAllapplicationDetails(String name)
- {
- List<Application> app=new ArrayList<Application>();
- try
- {
- Connection con = null;
- String dbUrl = "jdbc:oracle:thin:@localhost:1521:XE";
- System.out.println("1 step");
- Class.forName("oracle.jdbc.driver.OracleDriver");
- System.out.println("2 step");
- con = DriverManager.getConnection (dbUrl, "system", "system");
- System.out.println("3 step");
- PreparedStatement ps = con.prepareStatement("select * from Application where LOWER(name) like '"+ name.toLowerCase()+"%'");
- System.out.println("Entering in to the fucntion 2");
- ps.execute();
- System.out.println("Entering in to the fucntion 13");
- ResultSet rs =ps.getResultSet();
- if(rs.next())
- {
- System.out.println("Entering in to the fucntion 4");
- Application abean=new Application();
- abean.setName(rs.getString(1));
- abean.setApplicationName(rs.getString(2));
- abean.setContactNumber(rs.getInt(3));
- app.add(abean);
- System.out.println("Entering in to the fucntion 1" + app);
- }
- }
- catch(SQLException e)
- {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return app;
- hs.setAttribute("detbean",dbean);
- if(dbean.isEmpty())
- {
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- out.print("<caption>Sorry, No Record Found</caption>");
- }
- else
- response.sendRedirect("Application.jsp");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement