读书人

post传值到另外页面另外页面获取不到

发布时间: 2012-01-16 23:36:51 作者: rapoo

post传值到另外页面,另外页面获取不到值或者是post没有成功,请指导
代码如下:
<form action="doinputknowledgebaseinfo.jsp" method="post" id="passForm" name="passForm">
<input type="hidden" id="categoryid"/>
<input name="seqid" type="hidden" id="seqid">
<table width="100%" class="DG_borderStyle_model">
<tr width="100%">
<td >
<div class="OW_mainPadding" style="padding-left:0px;padding-right:0px;">
<table width="100%" cellpadding="0" cellspacing="1">
<tr>
<td class="OW_LT_TD" >知识点分类:</td>
<td class="OW_RT_TD">
<input name="knowledgebaseinfoApply" type="text" id="categoryname" class="COM_textarea"><image src="<%=path%>/images/btn_operate.gif" onclick="categoryName_select()" style="cursor:hand"></image><font color=red>*</font>
</td>

</tr>
<tr>
<td class="OW_LT_TD" >知识点类型:</td>
<td class="OW_RT_TD">
<select id ="type" name="knowledgebaseinfoApply" class="COM_select" >
<option></option>
<option value=1>过程型知识</option>
<option value=2>描述型知识--事实知识</option>
</select><font color=red>*</font>
</td>
</tr>
<tr >
<td class="OW_LT_TD" >摘要:</td>
<td class="OW_RT_TD">
<textarea checkNeed="true" name="knowledgebaseinfoApply" onKeydown="textAreaMaxLength(2000,this)" cols='45' rows='3' class="COM_textarea" id="summary"></textarea><font color=red>*</font>
</td>
</tr>
<tr >
<td class="OW_LT_TD" >描述:</td>
<td class="OW_RT_TD">
<textarea checkNeed="true" name="knowledgebaseinfoApply" onKeydown="textAreaMaxLength(2000,this)" cols='45' rows='10' class="COM_textarea" id="describ"></textarea><font color=red>*</font>
</td>
</tr>
<tr>
<td class="OW_LT_TD" >关键字:</td>
<td class="OW_RT_TD" style="width:300px">
<input name="knowledgebaseinfoApply" style="width:250px" type="text" id="knowledgeId" class="COM_textarea"><image src="<%=path%>/images/btn_operate.gif" onclick="keyword_select()" style="cursor:hand"></image><font color=red>*</font>
</td>

</tr>
<tr>
<td class="OW_LT_TD" >作者:</td>
<td class="OW_RT_TD">
<input checkNeed="true" name="knowledgebaseinfoApply" type="text" id="author" class="COM_textarea"><font color=red>*</font>
</td>

</tr>
<tr >
<td class="OW_LT_TD" >备注:</td>
<td class="OW_RT_TD">
<textarea checkNeed="true" name="remark" onKeydown="textAreaMaxLength(100,this)" cols='45' rows='3' class="COM_textarea" id="remark"></textarea>


</td>
</tr>
</table>

</div>
</td>
</tr>
</table>
</form>


具体post控制如下:
function doinputknowledgebaseinfo()
{
var categoryname = document.getElementById("categoryname").value;
var categoryid = document.getElementById("categoryid").value;
var summary = document.getElementById("summary").value;
var describ = document.getElementById("describ").value;
var knowledgeId = document.getElementById("knowledgeId").value;
var type = document.getElementById("type").value;
var remark = document.getElementById("remark").value;
var author = document.getElementById("author").value;
var seqId = '<%=seqId%>';
//先不验证
if(checkOtWorkInfo()) //通过内容完整性及规范性验证
{

with(document.getElementById("passForm"))
{
alert("提交");
submit();
}
page_close();

}


}
接收页面:
String categoryid= RequestHelper.getNotNullString(request , "categoryid");
String remark= RequestHelper.getNotNullString(request , "remark");
String summary= RequestHelper.getNotNullString(request , "summary");
String describ = RequestHelper.getNotNullString(request , "describ");
String type = RequestHelper.getNotNullString(request , "type");
String author = RequestHelper.getNotNullString(request , "author");
String seqid = RequestHelper.getNotNullString(request , "seqid");
其中getNotNullString如下:
public static String getNotNullString(HttpServletRequest request, String param)
{
String value = request.getParameter(param);
if (null == value)
value = "";

return value;
}
接收不到任何值。。。。

[解决办法]

HTML code
<form action="doinputknowledgebaseinfo.jsp" method="post" id="passForm" name="passForm">    <input type="hidden" id="categoryid" name="categoryid"/><!--request在这里拿的是name,不是id,加个name属性-->  <input name="seqid" type="hidden" id="seqid">    <table width="100%" class="DG_borderStyle_model">        <tr width="100%">            <td >                       <div class="OW_mainPadding" style="padding-left:0px;padding-right:0px;">                    <table width="100%" cellpadding="0" cellspacing="1">                        <tr>                            <td class="OW_LT_TD" >知识点分类:</td>                            <td class="OW_RT_TD">                            <input name="knowledgebaseinfoApply" type="text" id="categoryname" class="COM_textarea"><image src="<%=path%>/images/btn_operate.gif" onclick="categoryName_select()" style="cursor:hand"></image><font color=red>*</font>                            </td>                                                          </tr>                            <tr>                            <td class="OW_LT_TD" >知识点类型:</td>                            <td class="OW_RT_TD">                                   <select id ="type" name="knowledgebaseinfoApply" class="COM_select" >                            <option></option>                            <option value=1>过程型知识</option>                            <option value=2>描述型知识--事实知识</option>                            </select><font color=red>*</font>                            </td>                            </tr>                            <tr >                            <td class="OW_LT_TD" >摘要:</td>                            <td class="OW_RT_TD">                            <textarea checkNeed="true" name="knowledgebaseinfoApply" onKeydown="textAreaMaxLength(2000,this)" cols='45' rows='3' class="COM_textarea" id="summary"></textarea><font color=red>*</font>                            </td>                            </tr>                            <tr >                            <td class="OW_LT_TD" >描述:</td>                            <td class="OW_RT_TD">                            <textarea checkNeed="true" name="knowledgebaseinfoApply" onKeydown="textAreaMaxLength(2000,this)" cols='45' rows='10' class="COM_textarea" id="describ"></textarea><font color=red>*</font>                            </td>                            </tr>                            <tr>                            <td class="OW_LT_TD" >关键字:</td>                            <td class="OW_RT_TD" style="width:300px">                            <input name="knowledgebaseinfoApply" style="width:250px" type="text" id="knowledgeId" class="COM_textarea"><image src="<%=path%>/images/btn_operate.gif" onclick="keyword_select()" style="cursor:hand"></image><font color=red>*</font>                            </td>                                                          </tr>                            <tr>                            <td class="OW_LT_TD" >作者:</td>                            <td class="OW_RT_TD">                            <input checkNeed="true" name="knowledgebaseinfoApply" type="text" id="author" class="COM_textarea"><font color=red>*</font>                            </td>                                                          </tr>                            <tr >                            <td class="OW_LT_TD" >备注:</td>                            <td class="OW_RT_TD">                            <textarea checkNeed="true" name="remark" onKeydown="textAreaMaxLength(100,this)" cols='45' rows='3' class="COM_textarea" id="remark"></textarea>                            </td>                        </tr>                    </table>                </div>            </td>        </tr>    </table></form> 

读书人网 >Java Web开发

热点推荐