struts , jsp问题:javax.servlet.…

本文介绍了在Struts框架中如何正确使用HTML标签来避免错误,特别是<html:select>标签必须放置在<html:form>标签内的注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

action 中
List wardList = wardDAOIface.findAll();
request.setAttribute("wardList", wardList);
jsp中
<body>
<html:select style="width:200" property="${ward}">
<html:optionsCollection property="${wardList}" value="ward" label="ward" />
</html:select>
</body>
报错:javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN

 

原因:<html:select />  必需用在 <html:form/>标签中

例如:

<html:form action="kkkkkk.do">   

<html:select style="width:200" property="${ward}" >   

<html:optionsCollection property="${wardList}" value="ward" label="ward" / >   

</html:select >   

</html:form> 

<tr> <td class="left"> <bean:message key="GuItemPropertyDto.countyCode" /> <app:equal name="riskCode" value="120A,120B">&nbsp;<font color="red">*</font></app:equal> </td> <td class="right"> <input name="InsuredGuRelatedPartyItemDistrictCode" class="codecode" type="text" style="width: 34%" value="<bean:write name='insuredGuRelatedPartyDto' property='itemDistrictCode' filter='true' />" title="<bean:write name='guInsuredPolicyRelatedPartyDto' property='itemDistrictCode' filter='true' />" ondblclick="code_CodeSelect(this,'itemDistrictCode&#39;,'0,1&#39;,'Y&#39;,'fm.InsuredGuRelatedPartyItemCityCode[].value');" onkeyup="code_CodeSelect(this,'itemDistrictCode&#39;,'0,1&#39;,'Y&#39;,'fm.InsuredGuRelatedPartyItemCityCode[].value');" onchange="setUpdateColor(this);code_CodeChange(this,'itemDistrictCode&#39;,'0,1&#39;,'Y&#39;,'fm.InsuredGuRelatedPartyItemCityCode[].value');"> <input name="InsuredGuRelatedPartyItemDistrictCName" class="codename" type="text" style="width: 55%" value="<bean:write name='insuredGuRelatedPartyDto' property='itemDistrictCName' filter='true' />" title="<bean:write name='guInsuredPolicyRelatedPartyDto' property='itemDistrictCName' filter='true' />" onchange="setUpdateColor(this);"> </td> </tr> 这是RelatedPartyInsured.jsp的部分内容,相关联的还有RelatedPartyInsured_data.jsp。这部分代码用于显示itemDistrictCode 区县的信息。 报错 ]] Root cause of ServletException. javax.servlet.jsp.JspException: No getter method for property: "itemDistrictCode" of bean: "insuredGuRelatedPartyDto" at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:987) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:225) 应该如何解决
最新发布
06-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值