SSH中在Action中怎么写查询出ID值最大的一条数据的方法,dao层中还要定义么 10
publicStringdongtaiXianshi(){Stringsql="max(dongtaiId)fromTDongtaiwheredel='no'";Syst...
public String dongtaiXianshi()
{
String sql = " max(dongtaiId)from TDongtai where del = 'no'";
System.out.println(dongtaiId);
List dongtailist=dongtaiDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("dongtailist", dongtailist);
return ActionSupport.SUCCESS;
}
我想在首页显示出ID值最大的数据的内容
首页中
<s:iterator value="#request.dongtailist" id="dongtai">
标题
<s:property value="#dongtai.dongtaiTitle"/>
内容
<s:property value="#dongtai.dongtaiNeirong"/>
struts.xml中
<action name="dongtaiXianshi" class="dongtaiAction" method="dongtaiXianshi">
<result name="success">/Index.jsp</result>
</action> 展开
{
String sql = " max(dongtaiId)from TDongtai where del = 'no'";
System.out.println(dongtaiId);
List dongtailist=dongtaiDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("dongtailist", dongtailist);
return ActionSupport.SUCCESS;
}
我想在首页显示出ID值最大的数据的内容
首页中
<s:iterator value="#request.dongtailist" id="dongtai">
标题
<s:property value="#dongtai.dongtaiTitle"/>
内容
<s:property value="#dongtai.dongtaiNeirong"/>
struts.xml中
<action name="dongtaiXianshi" class="dongtaiAction" method="dongtaiXianshi">
<result name="success">/Index.jsp</result>
</action> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询