📄 topicbean.java
字号:
package Bean;
import java.util.Hashtable;
public class TopicBean {
private int id;
private String topicname="";//专题名称
private String introduce="";//专题简介
//DBControl DC=new DBControl();
private Hashtable<String, String> errors=new Hashtable<String, String>();
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
public String getTopicname() {
return topicname;
}
public void setTopicname(String topicname) {
this.topicname = topicname;
}
public boolean validata(String action,int Id){//判断数据的正确性
boolean allok=true;
if(topicname.trim().equals("")){
errors.put("topicname","专题名不能为空!");
allok=false;
}
db.DB dt= new db.DB();
try {
if(action.trim().equals("edit")){
if(dt.IsSameRecordButitSelf("topic", "TopicName", topicname.trim(),Id)){
errors.put("topicname","专题名称相同!");
allok=false;
}
}else{
if(dt.IsSameRecord("topic", "TopicName", topicname.trim())){
errors.put("topicname","专题名称相同!");
allok=false;
}
}
}catch(Exception ex){
System.out.print(ex);
}finally{
dt.close();//关闭连接
}
return allok;
}
public void setErrorMsg(String err,String errMsg){
if((err!=null)&& (errMsg!=null)){
errors.put(err, errMsg);
}
}
public String getErrorMsg(String err){
String err_msg=(String)errors.get(err);
return (err_msg==null)?"":err_msg;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
//ResultSet rs=null;
db.DB dt=new db.DB();
this.topicname=dt.returnString("select Id,TopicName from topic where Id="+id);
dt.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -