%>
<jsp:forward page="emp.jsp">
</body>
</form>
<HR>
<a href="">新增</a>
<table border=1>
<tr>
<td>Empno</td>
<td>Ename</td>
<td>Job</td>
<td>Sal</td>
}
%>
<center>
雇员信息列表
<form action="" method="post">
查询条件:<br>
姓名:<input type="text" name="keyword">
<input type="submit" value="查询">
public static void main(String args[]){
int x = 10 ;
int y= 20 ;
int z = 50 ;
int max = x ; //定义一个变量,去的最大值
if(max<y){
max = y ; // 如果y比x大,则max的值是y
}
if(max<z){
</tr>
<%
}
set.close();
stmt.close();
conn.close();
%>
</table>
</center>
<td>Comm</td>
<td colspan="2">操作</td>
</tr>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
String keyword=null;
if(request.getParameter("keyword")!=null){
keyword=request.getParameter("keyword");
sql=sql+"and ename like '%"+keyword+"%'";
</body>
<html>
2.deleteemp.jsp文件
<body>
<%
int empno=Integer.parseInt(request.getParameter("empno"));
Class.forName("oracle.jdbc.driver.OracleDriver");
for(int y=0;y<line-x;y++){
System.out.print(" ") ;
}
for(int y=0;y<=x;y++){
System.out.print("* ") ;
}
System.out.println() ;
}
}
}
求三个数中的最大值
public class TestDemo45 {
<td><%=set.getDouble("comm")%></td>
<td><a href="">修改</a></td>
<td><a href="deleteemp.jsp?empno=<%=set.getInt("empno")%>">删除</a></td>
max = z ; // 如果z比max大,则max的值是z
}
System.out.println(max) ;
}
}
删除emp表中数据
1.emp.jsp文件
</head>
<body>
<%
String sql="select empno,ename,job,sal,comm from emp where 1=1";
<td><%=set.getInt("empno")%></td>
<td><%=set.getString("ename") %></td>
<td><%=set.getString("job") %></td>
<td><%=set.getDouble("sal") %></td>
}
System.out.println() ; //
}
}
}
用for循环打印正三角形
public class TestDemo44 {
public static void main(String args[]){
int line = 5 ; // 5
for(int x=0;x<line;x++){
பைடு நூலகம்
用java for循环打印9*9乘法表
public class NineNineMultiTable {
public static void main(String args[]){
for(int x=1;x<10;x++){
for(int y=1;y<=x;y++){
System.out.print(x + "*" + y+ "=" + x*y+"\t") ;
Statement stmt=conn.createStatement();
ResultSet set=stmt.executeQuery(sql);
while(set.next()){
%>
<tr>
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
Statement stmt=conn.createStatement();
String sql="delete from emp where empno="+empno;