首先,在HibernateDao中添加:
然后,server中添加:
在Action中,把从数据库得到的值赋给页面:
在页面中
public List findRepairItem(){
try
{
List list = this.getHibernateTemplate().find("from tablename a");
if(list == null || list.size() == 0)
{
return null;
}
return list;
}
catch (DataAccessException e)
{
throw new BaseRuntimeException(HibernateBaseDao.DATA_ACCESS_ERROR, e);
}
}
然后,server中添加:
/**
* 返回维修项目字符串
* @return
*/
public String getRepairItemStr()
{
CarFeeSelectBean bean = new CarFeeSelectBean(get..ItemList());
return bean.toString();
}
public List getRepairItemList(){
return ..Dao.find..Item();
}
在Action中,把从数据库得到的值赋给页面:
//获得维修项目列表
request.setAttribute("..Str", service.get..Str());
在页面中
var repairItemStr = "${repairItemStr}";