ActionFrom和request请求页面属性的区别

今天在研究ActionFrom和request请求页面属性的区别, 今日出现这样的问题让我很难以理解:
在我的Action里请求页面属性值,有的用ActionForm请求能得到,有的用request请求能得到,不知道为什么!
这个是我的页面属性值:
<form name="form1" method="post" action="<%=url%>?method=updateOtherPId&backUrl=${pageContext.request.contextPath}/service/search_InsurancePID.jsp" οnsubmit="submitForm2()">
<table width="70%" border="0" align="center">
<tr height="28">
<td align="center" width="13%">投保人:
<input type="hidden" name="tmp" id="tmp" value="<%=tmp%>"/>
<input type="hidden" name="pId" id="pId" value="<%=pId%>"/></td>
<td>
<input type="text" name="ph" id="ph" size="30" readOnly value="<%=ph%>"/>
<input type="hidden" name="backUrl" value="${pageContext.request.requestURL}?${pageContext.request.queryString}" />
<input type="hidden" name="backParam" value="" />
<input type="hidden" name="status" value="1" />
<input type="hidden" name="action" value="add" />
</td>
</tr>
<tr height="28">
<td align="center" width="13%">更改为:</td>
<td>
<input type="text" name="phtmp" id="phtmp" size="30" value=""/>
</td>
</tr>
<tr>
<td align="center" width="13%"> </td>
<td align="left" style="right:30xp">   
<input type="button" class="clsBtn2w" name="btn1" value="修改" οnclick="submitForm2();"/>    
<input type="button" name="btn1" class="clsBtn2w" value="取消" οnclick="javascript:history.go(-1)"/>
</td>
</tr>
</table>
</form>

<input type="hidden" name="pId" id="pId" value="<%=pId%>"/>这个隐藏域里的pId 在action里用ActionFrom得不到,当然我的ActionFrom也定义了pId的属性.但不知是为什么.
在action里呢:
String pId = request.getParameter("pId");
String phtmp = questionForm.getPhtmp();
int infoType = questionForm.getInfoType();
下面两项用ActionFrom就能得到其属性值, 上面的那个就要用request来得到.
今天研究到这里,差不多快研究懂了.等研究懂后发布出来和大家一起欣赏.
当然如果有对ActionFrom和request请求页面属性的区别理解深刻的同志,希望能不吝赐教.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值