📄 modstudentsaction.java
字号:
/**
* (c) Copyright 2007 computer01
*
* FILENAME : ModStudentsAction.java
* PACKAGE : com.computer01.action
* CREATE DATE : 2007-12-21
* AUTHOR : admin
* DESCRIPTION : 修改学生信息Servlet
*/
package com.computer01.action;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.computer01.entity.AllEntity;
import com.computer01.entity.TAB_CLASS;
import com.computer01.entity.TAB_STUDENTS;
import com.computer01.entitysuport.StudentsAssiImpl;
public class ModStudentsAction
extends HttpServlet{
private static final long serialVersionUID
= -2621638022025037348L;
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException{
// 获取表单数据
String STUNO = request.getParameter("STUNO");
String STUNAME = new String(
request.getParameter("STUNAME")
.getBytes("iso8859_1"));//中文字符
String CLASSNO = request.getParameter("CLASSNO");
//封装成实体
//班级实体
TAB_CLASS claentity = new TAB_CLASS();
claentity.setCLASSNO(new Integer(CLASSNO));
//学生实体
TAB_STUDENTS stuentity = new TAB_STUDENTS();
stuentity.setSTUNO(STUNO);
stuentity.setSTUNAME(STUNAME);
stuentity.setPK_TAB_CLASS(claentity);
//注册到allEntity
AllEntity allentity = new AllEntity();
allentity.setTabstudents(stuentity);
//存入数据库
StudentsAssiImpl stuimpl
= new StudentsAssiImpl();
//更新
stuimpl.updateEntity(allentity);
//转向列表页
response.sendRedirect(
request.getContextPath()
+"/web/jsp/studentsList.jsp");
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException{
doGet(request,response);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -