📄 aboutaction.java
字号:
package hibernate;
import hibernate.iml.About;
import hibernate.iml.BakmusicOperation;
import hibernate.iml.DBOperaion;
import java.util.Collection;
import java.util.Date;
import net.sf.hibernate.HibernateException;
public class AboutAction {
// Fields
private String id;
private String title;
private String detail;
private Date sysdate;
/** pagestr property */
private String pagestr;
/** page property */
private String page;
private int pageSize;
private String method;
private final String strSQLOrder = " order by sysdate desc";
public Collection getSelect(){
Collection collection = null;
String sqlString = " from About";
sqlString += strSQLOrder;
int Page = 1;
if((page!=null)&&(!page.equals(""))&&(!page.equalsIgnoreCase("null"))){
Page = Integer.parseInt(page);
}else page = "1";
Page = (Page<1)?1:Page;
try {
DBOperaion opHandle = new DBOperaion();
collection = opHandle.getAll(sqlString,Page,"about.jsp?page=");
pagestr = opHandle.getPageStr();
pageSize = opHandle.getPageSize();
} catch (HibernateException e) {
e.printStackTrace();
}
return collection;
}
public Collection getFirst(){
Collection collection = null;
String sqlString = " from About";
sqlString += strSQLOrder;
try {
DBOperaion opHandle = new DBOperaion();
opHandle.setPageSize(8);
collection = opHandle.getAll(sqlString,1,"");
} catch (HibernateException e) {
e.printStackTrace();
}
return collection;
}
public boolean delete(){
if( (id == null)||(id.equals(""))||(id.equals(" "))||(id.equals("null")) ) return false;
boolean returnCode = true;
try {
DBOperaion opHandle = new DBOperaion();
opHandle.delete(About.class,id);
} catch (HibernateException e) {
returnCode = false;
e.printStackTrace();
}
return returnCode;
}
public About getInfo(){
About object = null;
try {
DBOperaion opHandle = new DBOperaion();
object = (About)opHandle.getInfo(About.class,id);
if((page==null)||(page.equals(""))||(page.equalsIgnoreCase("null"))){
page = "1";
}
} catch (HibernateException e) {
e.printStackTrace();
}
return object;
}
public boolean insert(){
boolean returnCode = true;
if(isValid()){
About object = new About();
object.setSysdate(new Date());
object.setTitle(this.title);
object.setDetail(this.detail);
try {
BakmusicOperation opHandle = new BakmusicOperation();
opHandle.insert(object);
} catch (HibernateException e) {
returnCode = false;
e.printStackTrace();
}
}else returnCode = false;
return returnCode;
}
private boolean isValid(){
if( (detail == null)||(detail.equals(""))||(detail.equals(" "))||(detail.equals("null")) ) return false;
if( (title == null)||(title.equals(""))||(title.equals(" "))||(title.equals("null")) ) return false;
return true;
}
// Property accessors
/**
* Returns the page.
* @return String
*/
public String getPage() {
return page;
}
/**
* Set the page.
* @param page The page to set
*/
public void setPage(String page) {
this.page = page;
}
public String getPagestr() {
return pagestr;
}
public void setPagestr(String pagestr) {
this.pagestr = pagestr;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDetail() {
return this.detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public Date getSysdate() {
return this.sysdate;
}
public void setSysdate(Date sysdate) {
this.sysdate = sysdate;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -