两个table一个from提交的时候得不到输入的值

main5678 2014-04-07 04:11:59
<%@page import="org.springframework.web.context.request.SessionScope"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'select.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="css/north.css" type="text/css"></link>
<script type="text/javascript" src="easyui/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<link rel="stylesheet" href="easyui/themes/cupertino/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="easyui/themes/icon.css" type="text/css"></link>
<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
var gzcontent="";
function addTable()
{
var tableID=document.all.loop;
var oRow=tableID.insertRow(tableID.rows.length);
var oCell=oRow.insertCell(oRow.cells.length);
oCell.innerHTML=gzcontent;
}
function initContent()
{
gzcontent=document.all.tb1.outerHTML;
}

function delrow(){
var tab =document.getElementById("loop");
var rows = tab.rows.length;
if(rows>1){
tab.deleteRow("td");//table中的行索引是从0开始的
}else{
alert("Sorry!本行不能删除!");
}
}

function shenqing() {
window.location='<%=basePath%>people/suAppappAction.action';
}
</script>
</head>

<body onload="initContent()">
<h1 style="margin-left:470px;" >填写申请单</h1>
<table style="border-collapse:collapse;" border="1" cellspacing="0">
<tr>
<td style="width:170px;" align="center"><strong>申请物品</strong></td>
<td style="width:156px;" align="center"><strong>申请时间</strong></td>
<td style="width:166px;" align="center"><strong>申请人名</strong></td>
<td style="width:162px;" align="center"><strong>数量</strong></td>
<td style="width:160px;" align="center"><strong>下个处理人</strong></td>
<td style="width:156px;" align="center"><strong>当前状态</strong></td>
<td style="width:216px;" align="center"><strong>操作</strong></td>
</tr>
</table>
<div>
<form action="<%=basePath%>people/suAppappAction.action" method="post">
<table border="1" id="loop" cellspacing="0">
<tr>
<td>
<table id="tb1">
<tr>
<td align="center">
<select name="goods.GId" style="width:156px;">
<s:iterator value="listgoods">
<option value="<s:property value="GId"/>">
<s:property value="GName" />
</option>
</s:iterator>
</select>
</td>
<td align="center"><input name="afg.applyDate" type="text" class="easyui-datebox" required="required" /></td>
<td align="center">
<input name="emp.EId" type="hidden" value="${sessionScope.User.EId} ">
<input type="text" value="${sessionScope.User.EName} ">
</td>
<td align="center"><input name="afg.sapplyCount" type="text" ></td>
<td align="center">
<select id="status" name="emp.employeeByENextdealId" style="width:156px;">
<option value="0">部门经理</option>
</select>
</td>
<td align="center">
<select id="status" name="afg.applyStatus" style="width:156px;">
<option value="2">待审批</option>
</select>
</td>
<td align="center" >
<input type="button" value="继续申请物品" onclick="addTable()">
<input type="button" value="删除本行申请" onclick="delrow()">
</td>
</tr>
<tr>
<td align="center"><strong>申请事由:</strong></td>
<td colspan="3"><input name="afg.applyReason" type="text" style="width: 500px;"></td>
</tr>
</table>
</td>
</tr>
</table>
<input type="submit" name="add" value="申请" style="width:56px;" onclick="shenqing()"/>
<input type="reset" name="resets" value="重置" style="width:56px;"/>
</form>
</div>
</body>
</html>



两个table一个from提交的时候得不到输入的值求大神赐教啊?????
...全文
227 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
main5678 2014-04-09
  • 打赏
  • 举报
回复
原因出来了!<input name="emp.EId" type="hidden" value="${sessionScope.User.EId} "> 就是他错了!这个隐藏域在action中获取不到,导致的整个页面都没获取到!把他删除了,在action中直接获取他的值就好了! 不管怎么样谢谢大家的鼎力相助!
yumaodeyu 2014-04-09
  • 打赏
  • 举报
回复
楼主,你想用onclick事件的话,请在事件调用的函数里将form表单提交一下。你现在的写法只是跳转了链接,除此之外什么都没做,所以后台没有获得任何数据是正常的。建议你采用ajax调教表单。 或者说,你可以用submit按钮提交,然后在onsubmit事件里调用你期望提交前执行的操作。 document.all属性只在ie返回true,也就是说,它的其他用法只在ie下好用,如果楼主不限制浏览器使用的话,建议不要使用.all
  • 打赏
  • 举报
回复
<form action="<%=basePath%>people/suAppappAction.action" method="post">先看看你的路径有没有问题
番茄鲨鱼面 2014-04-09
  • 打赏
  • 举报
回复
window.location只是定向到了Action,但是没有提交表单,完全可以不要这个js方法的,因为你里面也没有做什么验证操作。是这个理吧?
tony4geek 2014-04-08
  • 打赏
  • 举报
回复
提交你form 要submit
Spring89 2014-04-08
  • 打赏
  • 举报
回复
你“申请”按扭是submit类型,而submit是提交,对onclick是无效的!你应该在form加上onsubmit=“return true”事件
迷失lost 2014-04-08
  • 打赏
  • 举报
回复
点击申请按钮先执行onclick事件,执行shenqing() 方法直接跳转页面了 没有提交表单
guo624587253 2014-04-08
  • 打赏
  • 举报
回复
没有看明白!!!!!!!!!!!!
Legend-Hu 2014-04-08
  • 打赏
  • 举报
回复
问题描述清楚点,报什么错了?
且活且珍惜 2014-04-08
  • 打赏
  • 举报
回复
你看看shenqing()方法执行了吗,要是执行了,直接跳转根本就没有传参,或者把submit的onlick去掉
main5678 2014-04-08
  • 打赏
  • 举报
回复
引用 14 楼 u011765218 的回复:
<input type="submit" name="add" value="申请" style="width:56px;"/> 为什么跳不过去呢? 没报错吗? 先搞清这个问题!
没有报错。但是也跳不过去,点着都不起作用!这是怎么回事啊??我加了个onclick事件才跳转到action中的,但是数据又没过去!
itzgs 2014-04-08
  • 打赏
  • 举报
回复
<input type="submit" name="add" value="申请" style="width:56px;"/> 为什么跳不过去呢? 没报错吗? 先搞清这个问题!
main5678 2014-04-08
  • 打赏
  • 举报
回复
这是提交到后台的Action 但是为什么数据过不来呢????????????
main5678 2014-04-08
  • 打赏
  • 举报
回复
引用 11 楼 nieleifang 的回复:
后台用的是什么框架
ssh
蹭蹭一笑 2014-04-08
  • 打赏
  • 举报
回复
后台用的是什么框架
main5678 2014-04-08
  • 打赏
  • 举报
回复
引用 8 楼 jieqixun 的回复:
在 IE 中 document.all 的布尔值是 true ,其他浏览器都是 false。
刚才引用错了。你说的这个是什么意思啊?要怎么做才能得到值啊?
main5678 2014-04-08
  • 打赏
  • 举报
回复
引用 7 楼 main823257506 的回复:
提交from 我要是用submit根本就提交不过去,点着submit的按钮就不起作用,用onclick事件可以提交到action中,但是数据过不去,有谁有更好的方法吗???求大神赐教!!!!
这是什么意思啊??要怎么做啊?
jieqixun 2014-04-08
  • 打赏
  • 举报
回复
在 IE 中 document.all 的布尔值是 true ,其他浏览器都是 false。
main5678 2014-04-08
  • 打赏
  • 举报
回复
提交from 我要是用submit根本就提交不过去,点着submit的按钮就不起作用,用onclick事件可以提交到action中,但是数据过不去,有谁有更好的方法吗???求大神赐教!!!!
main5678 2014-04-07
  • 打赏
  • 举报
回复
有谁知道吗???????难道就没人吗???

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧