`
smartan
  • 浏览: 182037 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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){}
 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics