首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

S2SH修改Action得不到页面的值,求解?

2012-02-23 
【急】S2SH修改Action得不到页面的值,求解???DAO[color#FF0000][/color]public boolean updateInfo(StockHo

【急】S2SH修改Action得不到页面的值,求解???
DAO[color=#FF0000][/color]
public boolean updateInfo(StockHolders stockHolders) ;

public StockHolders getInfoByCode(String stockCode);


DaoImp[color=#FF0000][/color]
public StockHolders getInfoByCode(String stockCode) {
return (StockHolders)this.getHibernateTemplate().get(StockHolders.class,stockCode);
}

public boolean updateInfo(StockHolders stockHolders) {
this.getHibernateTemplate().update(stockHolders);
return false;
}


Service[color=#FF0000][/color]
public StockHolders getInfoByCode(String stockCode);

public boolean updateInfo(String stockCode);


ServiceImp[color=#FF0000][/color]

public StockHolders getInfoByCode(String stockCode) {
infoDao.getInfoByCode(stockCode);
return null;
}


public boolean updateInfo(String stockCode) {
StockHolders sHolders = infoDao.getInfoByCode(stockCode);
infoDao.updateInfo(sHolders);
return false;
}


Action[color=#FF0000][/color]
public String updateInfo()throws Exception{
if(this.getStockCode()!=null){
System.out.println("==============");
sHolders = (StockHolders)infoService.getInfoByCode(this.getStockCode());
if (sHolders != null) {
System.out.println("sHolders有数据");
ServletActionContext.getRequest().setAttribute("sHolders", sHolders);
return "update";
} else {
//sHolders = new StockHolders();
//sHolders.setStockCode(this.getStockCode());
//sHolders.setUserId(this.getUserId());
//sHolders.setUserStockNumber(this.getUserStockNumber());
//sHolders.setUserConsumption(this.getUserConsumption());
//sHolders.setUserStartTime(this.getUserStartTime());
//sHolders.setUserEndTime(this.getUserEndTime());
//sHolders.setTotalCount(this.getTotalCount());
//sHolders.setTotalAmount(this.getTotalAmount());
//sHolders.setTotalNumber(this.getTotalNumber());
//sHolders.setUserLevel(this.getUserLevel());
//sHolders.setIsValid(this.getIsValid());
//sHolders.setRemark(this.getRemark());
}
if (infoService.updateInfo(this.getStockCode())) {
System.out.println("更新成功!!");
return "success";
}
}
System.out.println("更新失败!!");
return "error";
}


[解决办法]
Action 中属性名与页面input name 一样不?
[解决办法]
哥们 问问题 最起码 问题描述清楚啊 报什么错? 你要什么结果?
[解决办法]
我叻个去
看的好吃力
楼主你打下断点跟踪一下呗
System.out.print(this.getStockCode());
把这个值打印出来看有没有
如果没有就去看页面和Action的对应关系是否有问题

热点排行