Struts参数名称的Bug
来源:互联网 发布:康泰尔a1 数据 编辑:程序博客网 时间:2024/05/19 19:39
Struts参数名称的Bug
应用Struts架构的web程序员越来越多,但不知道你们是否遇到过,在写jsp页面时,需要提交到表单中的参数名并不是所有的名字都可取。
之前,基于struts写得jsp页面,应该不算少了,一直没有遇到,直到昨天,修改一个别人程序里的bug,调试了半天,发现,原来struts对有些参数名称的处理有问题。
<logic:iterate id="view" name="compensationBalanceForm" property="listChunk.collection" indexId="index" type="com.neusoft.ehr.business.compensation.balance.BalanceViewVO" >
<tr class="<%=(index.intValue() % 2 == 0) ? "alternateA" : "alternateB"%>">
<td nowrap><bean:write name="view" property="employeeCode"/></td>
<td nowrap><bean:write name="view" property="employeeName"/></td>
<td nowrap><bean:write name="view" property="year"/></td>
<td nowrap><html:text name="view" property="value" onchange="javascript:changeValue (this.value)" /></td>
<td>
<a href="javascript:viewUpdate(<bean:write name="view" property="oid"/>)">
<bean:message bundle="compensation" key="cb.policy.edit.editMode.replace"/>
</a>
</td>
</tr>
</logic:iterate>
上面这段代码在提交时,就会出现问题,系统运行在struts处理时就出了问题,根本到不了我们自己的系统就停了 。org.apache.commons.beanutils.BeanUtils 类在处理参数时出现了问题。
下面是该jsp文件编译后的java文件对应部分代码:
private boolean _jspx_meth_html_text_5(javax.servlet.jsp.tagext.Tag _jspx_th_logic_iterate_0, javax.servlet.jsp.PageContext pageContext)
throws Throwable {
JspWriter out = pageContext.getOut();
/* ---- html:text ---- */
org.apache.struts.taglib.html.TextTag _jspx_th_html_text_5 = (org.apache.struts.taglib.html.TextTag) _jspx_tagPool_html_text_property_onchange_name.get(org.apache.struts.taglib.html.TextTag.class);
_jspx_th_html_text_5.setPageContext(pageContext);
_jspx_th_html_text_5.setParent(_jspx_th_logic_iterate_0);
_jspx_th_html_text_5.setName("view");
_jspx_th_html_text_5.setProperty("value");
_jspx_th_html_text_5.setOnchange("javascript:changeValue(this.value)");
int _jspx_eval_html_text_5 = _jspx_th_html_text_5.doStartTag();
if (_jspx_th_html_text_5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return true;
_jspx_tagPool_html_text_property_onchange_name.reuse(_jspx_th_html_text_5);
return false;
}
运行时,后提示Property : "value" has not set Method !!! 从表面看不应该有错误。如果我们在这里将value 修改为其他名字,比如 "valueSecond" ,并修改相应业务方法后,从新运行系统,一切正常了。这就是strut在组装表单时,对参数名为“value”的处理的不正确。
希望大家看了后不要再来这里浪费时间调试!!!
coolwangyu@Gmail.com
- Struts参数名称的Bug
- Struts 2.1 的bug 之一
- 修改Struts2的struts.xml配置文件位置和名称-重点是init-param参数用来切换加载的路径
- 使用struts编写的bug管理(一)
- 使用struts编写的bug管理(二)
- 使用struts编写的bug管理(三)
- 使用struts编写的bug管理(四)
- Mybatis传多个参数的bug
- struts 带参数的跳转
- 初始化struts的value参数
- Struts.xml的参数传递
- Hibernate的JavaBean属性名称大小写的一个Bug
- Hibernate的JavaBean属性名称大小写的一个Bug
- xfire 修改wsdl的参数名称
- request接收全部请求参数的名称
- 10.2 Swift方法的参数名称
- spark-submit的参数名称解析
- Spring LocalVariableTableParameterNameDiscoverer 获取方法的参数名称
- Apache中的表格实现剖析(2)
- 被三毛钱难倒
- 类似Excel行头标题(3)
- 看在亲爱的父母的面子上,对自己好一些[爱自己,就是对父母最好的爱!]
- 如何止赢保利润
- Struts参数名称的Bug
- ASP.NET程序中常用的三十三种代码(1)
- 在TCP三次握手后插入伪造的TCP包
- ASP.NET程序中常用的三十三种代码(2)
- ASP.NET程序中常用的三十三种代码(3)
- ASP.NET程序中常用的三十三种代码(4)
- [译]Skype可提供僵尸网络控制
- ASP.NET程序中常用的三十三种代码(5)
- WINDOWS自带可以杀掉系统进程的命令