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

📄 objtores.java

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

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

import org.apache.commons.beanutils.BeanUtils;

import sfs.entity.Score;
import sfs.entity.Student;
import sfs.entity.Teacher;

public class ObjToRes{
	private Object object;
	public  ObjToRes(String table,Object obj) throws SQLException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{
		if (table=="user_teacher"){
			object=(Teacher)obj;
		}
		if (table=="user_student"){
			object=(Student)obj;
		}
		if (table=="st_score"){
			object=(Score)obj;
		}
	}
	//取得int类型字段	
	public  int getInt(String name) throws NumberFormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{
		int temp=0;
		temp=Integer.parseInt(BeanUtils.getProperty(object,name));
		return temp;
	}
	
	
	//取得String类型字段
	public String getString(String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException{
		String temp;
		temp=BeanUtils.getProperty(object,name);
		return temp;		
	}
}

⌨️ 快捷键说明

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