Yenso 2015-09-17 10:43 采纳率: 0%
浏览 1732

ssh框架update()无法获取数据

调试了很久的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显示无法获取数据来修改
  • 写回答

3条回答 默认 最新

  • threenewbee 2015-09-17 13:33
    关注

    先去掉你的try catch,看下错误信息。把错误信息贴出来。估计是映射有问题。

    评论

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)