📄 usingdatabean.jsp
字号:
<%@page contentType="text/html"%>
<%@page pageEncoding="GB2312"%>
<%@page import="java.sql.*"%>
<jsp:useBean id="DataBean" scope="session" class="bean.DataBean"/>
<%
Connection conn=DataBean.setConnection("employee");
DataBean.setModify
("DELETE FROM employee WHERE dep='排版部';");
DataBean.setModify
("UPDATE employee SET dep='经管部' WHERE name='陈笑笑';");
DataBean.setModify
("INSERT INTO employee VALUES('张小霞','编辑部',357);");
DataBean.setModify
("INSERT INTO employee VALUES('吴晓天','销售部',812);");
%>
<html>
<title>修改数据表记录</title>
<body>
<table border="1">
<tr ><th>姓名</th><th>部门</th><th>分机号码</th></tr>
<%
ResultSet rs=DataBean.getQuery("SELECT * FROM employee");
while(rs.next()){
%>
<tr><td><%=rs.getString("name")%></td>
<td><%=rs.getString("dep")%></td>
<td align="center"><%=rs.getInt("phone")%></td></tr>
<%
}
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -