用struts1 做 表格 通过一个jsp页面(有两个下拉列表 列数:行数:)下边有一个提交按钮
根据所选行数列数 跳转另一个jsp页面 显示一个多行多列的表格 表格中用“*”;
求action里些什么东西

解决方案 »

  1.   


    这需要用struts么,直接js搞定哇
      

  2.   

    我是实习生 让我用struts做、、我郁闷 我是个菜鸟
      

  3.   

    传递行数和列数啊 
    新页面循环 有几行就几个tr 几列就几个td
      

  4.   

      <form action="biao1.do" method="post">
       <table align="center" border="0" cellspacing="0" cellpadding="0" width="300px">
        <tr>
        <td align="center">行数:</td>
        <td><select name="hs" id="hs">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3" selected="selected">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        </select>
        </td>
       <td align="center" >个数:</td>
        <td><select name="ls" id="ls">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6" selected="selected">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        </select>
        </td>
        </tr>
        <tr>
        <td align="center" style="padding-top: 100px" colspan="4">
        <input type="submit" value="提交"/>
        </td>
        </table>
       </form>
    public class BiaoAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    // TODO Auto-generated method stub
    //PrintWriter out=response.getWriter();
    //String hs=request.getParameter("hs");
    //String ls=request.getParameter("ls");
    //int hang1=Integer.parseInt(hs);
    //int lie1=Integer.parseInt(ls);
    String hang = request.getParameter("hs")==null?"0":request.getParameter("hs");
    String lie = request.getParameter("ls")==null?"0":request.getParameter("ls");

    request.setAttribute("hang1", hang);
    request.setAttribute("lie1", lie);

    return mapping.findForward("success");
    }
       <action-mappings>
     
         <action name="biao"
       path="/biao1"
       type="com.dllt.action.BiaoAction"
       scope="request">
       <forward name="success" path="/result.jsp"></forward>
       </action>
      </action-mappings>
     <body>
     <table align="center" border="1" cellspacing="0" cellpadding="0">
      <%
      int hs=Integer.parseInt((String)request.getAttribute("hang1"));
      int ls=Integer.parseInt((String)request.getAttribute("lie1"));
      for(int i=0;i<hs;i++)
      {
      %>
      <tr>
      <%
     
      for(int j=0;j<ls;j++)
      {%>
      <td>*</td>
      <%
      }
      %>
        
      </tr>  <%
      }
      %>
        
      </table>
      </body>
      

  5.   

    接受传过来的行数和列数,做一下校验,response给另一个jsp