<%
    String id = request.getParameter("id");
%>
<form name="BmBmCx" action="#">
<tr>
请输入部门别名:
<td valign="top">
<input name="BmSx" type="text">
<input name="" type="submit">
</td>
</tr>
</form>
这是一段简单的代码,我想问的是,如何用from表单把id 的值传本页面呢。

解决方案 »

  1.   

    <input id="id" type="hidden" value="id"> 
      

  2.   

    你的id不是int吗?
    <%
        Integer id = (Integer)request.getParameter("id");
    %> 
       ID:<%=id %>
      

  3.   

    传本页面?  - -|   我还真没明白大哥的意思..jsp 9大内置对象应该知道吧!用 page  对象试试吧..   page对象是java.lang.Object类的一个实例。它指的是JSP实现类的实例,也就是说,它是JSP本身,通过这个可以对它进行访问
      

  4.   

    本页面就直接读取哦:<%=id %>
      

  5.   

    不对啊,我的想法是这样的。
    <% 
        String id = request.getParameter("id"); 
    %> 
    <form name="BmBmCx" action="#"> 
    <tr> 
    请输入部门别名: 
    <td valign="top"> 
    <input name="BmSx" type="text"> 
    <input name="" type="submit"> 
    </td> 
    </tr> 
    </form>
    <%
         String strSQL = "select * from Hospital_Bed where DelFlag <> '1' and DeptId = "+id+" and Room like '%"+BmCx+"%'";
            ResultSet rs = sts.executeQuery(strSQL);
    %>
    我要设计一个查询功能,但是,我现在实现不了,因为点下submit的时候,id的值就变成null了。
      

  6.   


    <% 
        String id = request.getParameter("id"); 
    String sBmCx= request.getParameter("BmCx"); 
    %> 
    <form name="BmBmCx" action="#"> 
    <tr> 
    请输入部门别名: 
    <td valign="top"> 
    <input name="BmSx" type="text"> 
    <input name="id" type="text"> 
    <input name="" type="submit"> 
    </td> 
    </tr> 
    </form> 
    <% 
        String strSQL = "select * from Hospital_Bed where DelFlag <> '1' and DeptId = "+id+" and Room like '%"+sBmCx+"%'"; 
            ResultSet rs = sts.executeQuery(strSQL); 
    %> 
      

  7.   

    如果id不需要显示的话
    <input name="id" type="hidden" value=<%=id%>> 
      

  8.   

    高手哦  在JSP页面上写操作数据库的
    .............
      

  9.   

    <input name="id" type="text" value= <%=id%>> 
      

  10.   

    <input name="id" type="text" value= " <%=id%> "/>