调试了很久的BUG都解决不了求各位大神解答一下谢谢了
UpdateAction.java
public class UpdateAction extends ActionSupport {
private String userName;
private String userPwd;
private String userRname;
private String userEmail;
private String userCompany;
private String userTel;
private String userFax;
private IEpUserService epUserService;
public UpdateAction() {
}
public UpdateAction(String userName, String userPwd, String userRname,
String userEmail, String userCompany, String userTel,String userFax
) {
super();
this.userName = userName;
this.userPwd = userPwd;
this.userRname = userRname;
this.userEmail = userEmail;
this.userCompany = userCompany;
this.userTel = userTel;
this.userFax = userFax;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPwd() {
return userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public String getUserRname() {
return userRname;
}
public void setUserRname(String userRname) {
this.userRname = userRname;
}
public String getUserEmail() {
return userEmail;
}
public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}
public String getUserCompany() {
return userCompany;
}
public void setUserCompany(String userCompany) {
this.userCompany = userCompany;
}
public String getUserTel() {
return userTel;
}
public void setUserTel(String userTel) {
this.userTel = userTel;
}
public String getUserFax() {
return userFax;
}
public void setUserFax(String userFax) {
this.userFax = userFax;
}
public IEpUserService getEpUserService() {
return epUserService;
}
public void setEpUserService(IEpUserService epUserService) {
this.epUserService = epUserService;
}
public String execute()
{
EpUser epUser = new EpUser(userName, userPwd, userRname,userEmail, userCompany,userTel,
userFax,null,null);
if (epUserService.update(epUser))
return SUCCESS;
else
return ERROR;
}
IEpUserDAO.java
public interface IEpUserDAO
{
public void update(EpUser persistentInstance);
}
EpUserDAO.java
public void update(EpUser transientInstance) {
log.debug("updating EpUser instance");
try {
getHibernateTemplate().getSessionFactory().openSession().update(transientInstance);
log.debug("update successful");}
catch (RuntimeException re)
{
log.error("update failed", re);
throw re;
}
}
IEpUserService.java
public interface IEpUserService
{
public boolean update(EpUser epUser);
}
EpUserService.java
public class EpUserService implements org.ssh.service.IEpUserService
{
private IEpUserDAO epUserDao;//要进行注入
public IEpUserDAO getEpUserDao() {
return epUserDao;
}
public void setEpUserDao(IEpUserDAO epUserDao) {
this.epUserDao = epUserDao;
}
public boolean update(EpUser epUser) {
epUserDao.update(epUser);
return true;
}
}
EpUser.java
public EpUser(String userName, String userPwd) {
this.userName = userName;
this.userPwd = userPwd;
}
/** full constructor */
public EpUser(String userName, String userPwd, String userRname,
String userEmail, String userCompany, String userTel,
String userFax, Integer userRight,String userDatetime
) {
this.userName = userName;
this.userPwd = userPwd;
this.userRname = userRname;
this.userEmail = userEmail;
this.userCompany = userCompany;
this.userTel = userTel;
this.userFax = userFax;
this.userRight = userRight;
this.userDatetime = userDatetime;
get()和set()省略……
struts.xml
<action name="UpdateAction" class="org.ssh.action.UpdateAction">
<result name="success">/user/updateSuccess.jsp</result>
<result name="error">/user/editError.jsp</result>
</action>
求指点
前面写了个save方法可以写入数据,但是用update显示无法获取数据来修改