关于Validation的错误,请大家帮忙看看

jackedfang 2004-03-19 05:37:45
jsp页面如下:
<%@ taglib uri="struts/bean-el" prefix="bean" %>
<%@ taglib uri="struts/html-el" prefix="html" %>
<%@ taglib uri="struts/logic-el" prefix="logic" %>
<%@ taglib uri="jstl/c" prefix="c" %>
<html>
<head>
<link href="<html:rewrite page="/rr.css" />" rel="stylesheet" type="text/css">
<center><title><bean:message key="title.devicestatus.deviceStatusForm"/></title></center>
</head>
<body><center>
<c:choose>
<c:when test="${DeviceActionForm.map.dispatch == 'insert'}">
<h1><bean:message key="title.devicestatus.insertDeviceStatusForm"/></h1>
</c:when>
<c:otherwise>
<h1><bean:message key="title.devicestatus.updateDeviceStatusForm"/></h1>
</c:otherwise>
</c:choose>
<!-- this should be an include or, better yet, use tiles and make this a footer !-->
<logic:messagesPresent>
<span id="errorsHeader"><bean:message key="errors.validation.header"/></span>
<html:messages id="error">
<li><c:out value="${error}"/></li>
</html:messages>
<hr>
</logic:messagesPresent>

<logic:messagesPresent message="true">
<html:messages id="message" message="true">
<span id="success"><c:out value="${message}"/></span><br>
</html:messages>
</logic:messagesPresent>

<html:form action="deviceStatusAction" focus="status">
<table>
<tr>
<td ><bean:message key="display.devicestatus.status"/></td>
<td><c:choose>
<c:when test="${DeviceStatusForm.map.dispatch == 'insert'}">
<html:text property="status"/>
</c:when>
<c:otherwise>

<html:text property="status"/>
</c:otherwise>
</c:choose>
</td>
</tr>

<tr>
<td ><bean:message key="display.devicestatus.statusName"/></td>
<td><html:text property="statusName"/></td>
</tr>
<tr>
<td ><bean:message key="display.devicestatus.deviceTypeId"/></td>
<!--td><html:text property="deviceTypeId"/></td-->
<td><html:select name="DeviceStatusForm" property="deviceTypeId">
<html:options collection="deviceInfoDict" property="id" labelProperty="name"/>
</html:select>
</td>
</tr>

</table>
<html:hidden name="DeviceStatusForm" property="dispatch"/>
<html:hidden property="recId"/>

<c:choose>
<c:when test="${DeviceStatusForm.map.dispatch == 'insert'}">
<html:submit><bean:message key="button.submit"/></html:submit>
</c:when>
<c:otherwise>
<html:submit><bean:message key="button.update"/></html:submit>
</c:otherwise>
</c:choose>

</html:form>
</center></body>
</html>
我要对status加一个验证,validation.xml文件如下:
<form name="DeviceStatusForm">
<field property="status"
depends="required,maxlength">
<arg0 key="display.deviceaction.deviceTypeId"/>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>4</var-value>
</var>
</field>
</form>
struts-config.xml文件如下:
<action path="/deviceStatusAction"
type="sc.snow.devicestatus.DeviceStatusAction"
name="DeviceStatusForm"
scope="request"
validate="true"
parameter="dispatch"
input="/pages/devicestatus/deviceStatusForm.jsp"
>
<forward
name="continue"
path="/pages/devicestatus/deviceStatusResult.jsp"/>
</action>
错误信息是:
javax.servlet.ServletException: Cannot find bean under name deviceInfoDict
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.pages.devicestatus.deviceStatusForm_jsp._jspService(deviceStatusForm_jsp.java:132)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
...全文
61 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hajavaor 2004-03-24
  • 打赏
  • 举报
回复
就给10分,太小气了吧。
干脆再公开你的电话吧,呵呵。

阿勇
hiking 2004-03-22
  • 打赏
  • 举报
回复
你对这相关的关联性到底了不了解?
yeshucheng 2004-03-22
  • 打赏
  • 举报
回复
去看看你的web.xml中的配置
jackedfang 2004-03-22
  • 打赏
  • 举报
回复
没人帮忙看啊?我自己顶啦。

51,397

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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