jsp 페이지 호출 동작, 실용적입니다

2318 단어 DAOhtmljsp
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.mldn.lxh.vo.*"%>
<%@ page import="cn.mldn.lxh.dao.*"%>
<%@ page import="cn.mldn.lxh.dao.impl.*"%>
<%@ page import="cn.mldn.lxh.factory.*"%>


<%
//           
	try
	{
		List l = DAOFactory.getPersonDAOInstance().queryByLike(" ");
		Iterator iter = l.iterator();
		while(iter.hasNext())
		{
			Person person = (Person)iter.next();
			out.println(person.getName()+"<br>");
		}
	}
	catch(Exception e)
	{

	}
%>

<%--
//             ,  Iterator
	PersonDAO dao = new PersonDAOImpl();
	
	try
	{
		List l = dao.queryAll();
		Iterator iter = l.iterator();
		while(iter.hasNext())
		{
			Person person = (Person)iter.next();
			out.println(person.getName()+"<br>");
		}
	}
	catch(Exception e)
	{

	}
--%>

<%--
//                
	try
	{
		Person person = DAOFactory.getPersonDAOInstance().queryById("lwh");
		out.println(person.getName());
	}
	catch(Exception e)
	{

	}
--%>


<%--
//           
	Person person = new Person();
	person.setId("lwy");
	person.setName("  ");
	person.setPassword("11111111111111111");
	person.setAge(23);
	person.setEmail("[email protected]");

	
	try
	{
		DAOFactory.getPersonDAOInstance().update(person);
	}
	catch(Exception e)
	{
	}

--%>

<%--
//            
	Person person = new Person();
	person.setId("lwy");
	person.setName("  ");
	person.setPassword("11111111111111111");
	person.setAge(23);
	person.setEmail("[email protected]");
	
	PersonDAO dao = new PersonDAOImpl();
	
	try
	{
		dao.insert(person);
	}
	catch(Exception e)
	{
	}
--%>

좋은 웹페이지 즐겨찾기