SSH2修改功能怎么写,我按照这模式写update方法,但是实现不了 20
ACTION里添加等功能代码publicStringgonggaoAdd(){TGonggaogonggao=newTGonggao();gonggao.setGongg...
ACTION里添加等功能代码
public String gonggaoAdd()
{
TGonggao gonggao=new TGonggao();
gonggao.setGonggaoTitle(gonggaoTitle);
gonggao.setGonggaoContent(gonggaoContent);
gonggao.setGonggaoData(new Date().toLocaleString());
gonggaoDAO.save(gonggao);
this.setMessage("公告添加成功");
this.setPath("gonggaoMana.action");
return "succeed";
}
public String gonggaoMana()
{
List gonggaoList =gonggaoDAO.findAll();
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("gonggaoList", gonggaoList);
return ActionSupport.SUCCESS;
}
public String gonggaoDel()
{
TGonggao gonggao=gonggaoDAO.findById(gonggaoId);
gonggaoDAO.delete(gonggao);
this.setMessage("公告删除完毕");
this.setPath("gonggaoMana.action");
return "succeed";
}
DAO文件中
public void save(TGonggao transientInstance)
{
log.debug("saving TGonggao instance");
try
{
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re)
{
log.error("save failed", re);
throw re;
}
}
public void delete(TGonggao persistentInstance)
{
log.debug("deleting TGonggao instance");
try
{
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re)
{
log.error("delete failed", re);
throw re;
}
}
public TGonggao findById(java.lang.Integer id)
{
log.debug("getting TGonggao instance with id: " + id);
try
{
TGonggao instance = (TGonggao) getHibernateTemplate().get(
"com.model.TGonggao", id);
return instance;
} catch (RuntimeException re)
{
log.error("get failed", re);
throw re;
}
} 展开
public String gonggaoAdd()
{
TGonggao gonggao=new TGonggao();
gonggao.setGonggaoTitle(gonggaoTitle);
gonggao.setGonggaoContent(gonggaoContent);
gonggao.setGonggaoData(new Date().toLocaleString());
gonggaoDAO.save(gonggao);
this.setMessage("公告添加成功");
this.setPath("gonggaoMana.action");
return "succeed";
}
public String gonggaoMana()
{
List gonggaoList =gonggaoDAO.findAll();
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("gonggaoList", gonggaoList);
return ActionSupport.SUCCESS;
}
public String gonggaoDel()
{
TGonggao gonggao=gonggaoDAO.findById(gonggaoId);
gonggaoDAO.delete(gonggao);
this.setMessage("公告删除完毕");
this.setPath("gonggaoMana.action");
return "succeed";
}
DAO文件中
public void save(TGonggao transientInstance)
{
log.debug("saving TGonggao instance");
try
{
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re)
{
log.error("save failed", re);
throw re;
}
}
public void delete(TGonggao persistentInstance)
{
log.debug("deleting TGonggao instance");
try
{
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re)
{
log.error("delete failed", re);
throw re;
}
}
public TGonggao findById(java.lang.Integer id)
{
log.debug("getting TGonggao instance with id: " + id);
try
{
TGonggao instance = (TGonggao) getHibernateTemplate().get(
"com.model.TGonggao", id);
return instance;
} catch (RuntimeException re)
{
log.error("get failed", re);
throw re;
}
} 展开
2个回答
展开全部
Dao文件中
public boolean update(TGonggao transientInstance) {
try {
getHibernateTemplate().saveOrUpdate(transientInstance);
log.debug("update successful");
return true;
} catch (RuntimeException re) {
log.error("update failed", re);
return false;
}
}
public boolean update(TGonggao transientInstance) {
try {
getHibernateTemplate().saveOrUpdate(transientInstance);
log.debug("update successful");
return true;
} catch (RuntimeException re) {
log.error("update failed", re);
return false;
}
}
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询