⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createteform.java

📁 成绩查询系统(学校期末的作业) Struts+jdbc+mysql+tomcat 开发工具为BEA WORKSHOP 功能无非就是增删查改加用户权限判断
💻 JAVA
字号:
package sfs.struts.forms;

import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;

import sfs.entity.Teacher;
import sfs.entity.io.TeacherIo;

public class CreateTEForm extends ValidatorForm {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int id;//ID
	private String number;//账号
	private String password;//密码
	private String authority;//权限
	private String realname;//真实姓名
	private Teacher te;
	public CreateTEForm() {
		super();
		// TODO 自动生成构造函数存根
	}
	public String getAuthority() {
		return authority;
	}
	public void setAuthority(String authority) {
		this.authority = authority;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getRealname() {
		return realname;
	}
	public void setRealname(String realname) {
		this.realname = realname;
	}
	public void reset(ActionMapping arg0, HttpServletRequest request) {
		String id=request.getParameter("id");
		
		if (id==null) {
			this.authority="1";
			this.number = null;
			this.password = null;
			this.realname = null;
			
		}		
		if(id!=null&&!id.equals("0"))
		{			
				try {
					TeacherIo teio=new TeacherIo();
					te=(Teacher) teio.queryByid(Integer.parseInt(id)).get(0);
					this.id=Integer.parseInt(id);
					this.authority="1";
					this.number = te.getNumber();
					this.password = null;
					this.realname = te.getRealname();
				} catch (ClassNotFoundException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
				} catch (SQLException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
				} catch (NumberFormatException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
				} catch (InvocationTargetException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
				} catch (NoSuchMethodException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
				}
				
			
		}
		// TODO 自动生成方法存根
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -