当前位置: 代码迷 >> Web前端 >> 2011 十 21
  详细解决方案

2011 十 21

热度:495   发布时间:2012-08-24 10:00:21.0
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){}
?

  相关解决方案