jsp中代碼要寫<%%>java
<jsp:setProperty name="rent" property="width" param="width"/>sql
注意param和value 可能會出錯誤啊oracle
<jsp:setProperty name="rent" property="*"/>jsp
使用javabean要注意引進包啊url
<%@ page import="bean.rent" %>spa
<jsp:getProperty name="rent" property="xxxxx"/>code
<jsp:forward page="c.jsp"/> 也能夠進行跳轉get
oracle:io
class.forName("oracle.jdbc.driver.OracleDriver")table
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){}