📄 createst.java
字号:
package sfs.struts.actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import sfs.entity.Student;
import sfs.entity.io.StudentIo;
import sfs.struts.forms.CreateSTForm;
import sfs.tools.MD5;
public class CreateST extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
CreateSTForm cf=(CreateSTForm)form;
Student te=new Student();
MD5 md5=new MD5();
StudentIo stio=new StudentIo();
String id = null;
te.setId(cf.getId());
te.setAuthority(cf.getAuthority());
te.setNumber(cf.getNumber());
String psd=cf.getPassword();
if (psd==null&&id!="0") {
Student temp=(Student) stio.queryByid(cf.getId()).get(0);
te.setPassword(temp.getPassword());
}else{
te.setPassword(md5.getMD5ofStr(cf.getPassword()));
}
te.setRealname(cf.getRealname());
te.setClassname(cf.getClassname());
te.setDepartment(cf.getDepartment());
stio.saveorupdata(te);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -