2011 10 21

jsp中代码要写<%%>

<jsp:setProperty name="rent" property="width" param="width"/>

注意param和value  可能会出错误啊

<jsp:setProperty name="rent" property="*"/>

使用javabean要注意引进包啊

<%@ page import="bean.rent" %>

<jsp:getProperty name="rent" property="xxxxx"/>

<jsp:forward page="c.jsp"/>  也可以进行跳转

 

oracle:

class.forName("oracle.jdbc.driver.OracleDriver")



try{
			Class.forName("oracle.jdbc.driver.OracleDriver");
		}catch(ClassNotFoundException e){}
		try{
			String url="jdbc:oracle:thin:@localhost:1521:XE";
			Connection conn=DriverManager.getConnection(url,"ancong","ancong");
			Statement stmt=conn.createStatement();
			String sqlinsert="insert into product values('"+id+"','"+name+"','"+madeTime+"','"+price+"')";
			stmt.execute(sqlinsert);
			String sql="select * from product";
			ResultSet rs=stmt.executeQuery(sql);
		    out.print("<table border>");
			out.print("<tr>");
			out.print("<th width=100>"+"id");
			out.print("<th width=100>"+"name");
			out.print("<th width=100>"+"madeTime");
			out.print("<th width=100>"+"price");
			out.print("</tr>");
			while(rs.next()){
				out.print("<tr>");
				out.print("<td>"+rs.getString(1)+"</td>");
				out.print("<td>"+rs.getString(2)+"</td>");
				out.print("<td>"+rs.getString(3)+"</td>");
				out.print("<td>"+rs.getString(4)+"</td>");
				out.print("</tr>");
			}
			conn.close();
		}catch(SQLException e){}
 

你可能感兴趣的:(oracle,jsp,servlet)