框架出问题Struts has detected an unhandled exception:
Struts has detected an unhandled exception:
Messages: 1.zhiAction
2Unable to instantiate Action, zhiAction, defined for 'zhi_queryZhi' in namespace '/'zhiAction
File: org/apache/catalina/loader/WebappClassLoader.java
Line number: 1,358
ZhiAction.java:
package com.oa.actions;
import org.apache.struts2.ServletActionContext;
import com.oa.models.TZhi;
import com.oa.services.ZhiServices;
import com.oa.utils.PageInfo;
public class ZhiAction extends BaseAction{
private ZhiServices zhiServices;
private Integer id;
private String username;
private String password;
private String realname;
private String age;
private String card;
private String email;
private String phone;
private String searchname;
/**
*
*
* 查询
*
*/
public String queryZhi() throws Exception{
if (getSessionAttribute("querypageunit") == null) {
setSessionAttribute("querypageunit",this.pageunit);
}
StringBuffer cond = new StringBuffer();
if(null!=searchname&&""!=searchname.trim()){
cond.append(" and a.realname like '%"+searchname.trim()+"%' ");
}
int curpage = Integer.parseInt(this.getCurrentpage(ServletActionContext.getRequest()));
int pageunit = Integer.parseInt(this.getPageunit(ServletActionContext.getRequest(), "querypageunit"));
String url = "zhi_queryZhi?a=a";
PageInfo pageInfo = this.zhiServices.queryZhi(curpage,
pageunit, ServletActionContext.getRequest(), url, cond.toString());
setRequestAttribute("pageinfo", pageInfo);
setRequestAttribute("searchname", this.searchname);
return "queryZhi";
}
/**
*
*
* 添加
*
*/
public String addZhi() throws Exception{
//SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//Date date = new Date();
TZhi zhi = new TZhi();
zhi.setUsername(username);
zhi.setEmail(email);
zhi.setPassword(password);
zhi.setPhone(phone);
zhi.setRealname(realname);
zhi.setAge(age);
zhi.setCard(card);
zhiServices.addZhi(zhi);
return "addZhi";
}
/**
*
*
*
*
*/
public String preupdateZhi() throws Exception{
TZhi zhi = zhiServices.getZhi(id);
setRequestAttribute("zhiT",zhi);
return "preupdateZhi";
}
/**
*
*
* 修改
*
*/
public String updateZhi() throws Exception{
TZhi zhi = zhiServices.getZhi(id);
zhi.setUsername(username);
zhi.setEmail(email);
zhi.setPassword(password);
zhi.setPhone(phone);
zhi.setRealname(realname);
zhi.setAge(age);
zhi.setCard(card);
zhiServices.updateZhi(zhi);
return "updateZhi";
}
/**
*
*
* 删除
*
*/
public String delZhi() throws Exception{
zhiServices.delZhi(id);
return "delZhi";
}
public String outZhi() throws Exception{
getSessionMap().clear();
return "outZhi";
}
public ZhiServices getZhiServices() {
return zhiServices;
}
public void setZhiServices(ZhiServices zhitServices) {
this.zhiServices = zhiServices;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
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 String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getCard() {
return card;
}
public void setCard(String card) {
this.card = card;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getSearchname() {
return searchname;
}
public void setSearchname(String searchname) {
this.searchname = searchname;
}
}