📄 studentslistaction.jsp
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import = "com.computer03.entity.*"%>
<%@ page import = "com.computer03.entitysupport.*"%>
<%@ page import = "java.util.*"%>
<%! String[] stunoarr;%>
<%
out.print("开始接收表单数据请求");
out.print("<br>");
out.print("您选择的学号是:");
//获取表单的值
stunoarr =
request.getParameterValues("STUNO");
//获取用户点击的是何按钮
String action = new String(
request.getParameter("action")
.getBytes("iso_8859_1"));
out.print("<br>你点击了:<font color=red>"
+action+"</font><br>");
//增加
if("增加".equals(action)){
response.sendRedirect("./addStudents.jsp");
}
if(stunoarr!=null){
if(stunoarr.length>1&&"查看详细信息".equals(action)){
out.print("只能选择一个学生!!!");
out.print("<input type=button "
+ "onclick='history.back();' value='返回'>");
}else{
if("查看详细信息".equals(action)){
String stuno = stunoarr[0];
TAB_STUDENTS stu = new TAB_STUDENTS();
stu.setSTUNO(stuno);
AllEntity condition = new AllEntity();
condition.setStudent(stu);
StudentsAssiImpl impl =
new StudentsAssiImpl();
List stulist = impl.getEntityList(condition);
if(stulist!=null){
AllEntity entget =
(AllEntity)stulist.get(0);
TAB_STUDENTS stuget = entget.getStudent();
out.print("<form action=./modStudents.jsp name=form1>");
out.print("学号:"+stuget.getSTUNO()+"<br>");
out.print("姓名:"+stuget.getSTUNAME()+"<br>");
out.print("班号:"
+stuget.getPK_TABCLASS().getCLASSNO()+"<br>");
out.print("班级名称:"+
stuget.getPK_TABCLASS().getCLASSNAME()+"<br>");
out.print("<input type=hidden name=stuno "
+"value="+stuget.getSTUNO()+">");
out.print("<input type=submit value=修改>");
out.print("<input type=button value=返回 "
+"onclick=javascript:history.back(-1)> ");
out.print("</form>");
}}
if("删除".equals(action)){
for(int i =0;i<stunoarr.length;i++){
TAB_STUDENTS studel = new TAB_STUDENTS();
studel.setSTUNO(stunoarr[i]);
StudentsAssiImpl impl2 = new StudentsAssiImpl();
AllEntity conddel = new AllEntity();
conddel.setStudent(studel);
impl2.deleteEntity(conddel);
}
response.sendRedirect("./studentsList.jsp");
}}
}else{
out.print("<font color=red>请选择一个学生!!</font>");
response.setHeader("Refresh","1,URL=./studentsList.jsp");
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -