我悲剧啊 还是被出来不会了 用struts1 做 表格 通过一个jsp页面(有两个下拉列表 列数:行数:)下边有一个提交按钮根据所选行数列数 跳转另一个jsp页面 显示一个多行多列的表格 表格中用“*”;求action里些什么东西 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这需要用struts么,直接js搞定哇 我是实习生 让我用struts做、、我郁闷 我是个菜鸟 传递行数和列数啊 新页面循环 有几行就几个tr 几列就几个td <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> 接受传过来的行数和列数,做一下校验,response给另一个jsp java service 项目问题? java开发企业上多使用那个一linux系统? 遇到jdbcTemplate.queryForList怪异的问题 Properties文件读取后乱序 怎么给textarea赋值 请问OA系统中的内部信息交流该怎么做 session过期问题 Apache+tomcat实现集群后问题,急急急,在线等待。。。 最新TOMCAT怎么配置?快被气死了 项目管理经验丰富的JSP高手:请进,有项目需开发! oracle 查询 有没有比较好的基于Java的快速web开发平台推荐,最好带有已经开发的应用,比如oa,erp之类的,能方便进行二次开发。收费的就不要推荐了!
这需要用struts么,直接js搞定哇
新页面循环 有几行就几个tr 几列就几个td
<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>