📄 studentaction.java
字号:
package limq.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;
import limq.hibernate.vo.*;
import java.util.*;
public class StudentAction extends BaseAction {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
String stu_name=(String) session.getAttribute("username");
Students stu = super.getStudentsService().getStudetFromName(stu_name);
String password =(String)((DynaValidatorForm)form).get("password");
String address=(String)((DynaValidatorForm)form).get("address");
String email=(String)((DynaValidatorForm)form).get("email");
String phone =(String)((DynaValidatorForm)form).get("phone");
Contact con=stu.getContact();
con.setAddress(address);
con.setEmail(email);
con.setPhone(Integer.valueOf(phone));
stu.setPassword(password);
super.getStudentsService().updateSudent(stu,con);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -