什么意思?
select sum(field1) as sumValue from tableName;Int sum=rs.getInt("sumValue");
是这个嘛?

解决方案 »

  1.   

    是啊,现在如何将sum(field1)的值接收到文本框里,这样行吗?
      

  2.   

    有什么不行的?
    bean中方法这样写:至于连接数据库等这里我不写了:select sum(field1) as sumValue from tableName;List ls =new ArrayList();
    String sums = "";
    while(rs.next())
    {
        sums=rs.getString("sumValue");
        ls.add(sums);
    }
    request.setAttribute("ls",ls);
    前边jsp中
    <%
    List ls = (ArrayList)request.getAttribute("ls");
    for(int i =0;i<ls.size;i++)
    {
    %>
    <input type="txt" value =<%=ls.get(i)%> name= "erqwer">
    <%
    }
    %>
    还有一种直接返回取得的结果
    String sums ="";
    while(rs.next())
    {
        sums = rs.getString("sunValue");
    }
    return sums前边直接用返回的这个sums就可以了
      

  3.   

    你是说web页面啊?
     <input type="text" value=<%=sun%> >