我在做struts2校验时发现了下面的错误:
Invalid field value for field "cloth.clothPrice".
但我的代码是下面:
<field name="cloth.clothPrice" >
<field-validator type="regex">
<param name="expression"><![CDATA[^[0-9]*$]]></param>
<message>衣服价格必须是数字..</message>
</field-validator>
</field>
还有个问题,也是在同一个页面,还没有进行校验的时候下面的路径图片是可以显示出来的,但我输入不符合校验时,按提交,由于校验不正确所以跳回原页面时,图片既然显示不出来了。在页面测试时,发现开<s:property value="cloth.images"/>没有值输出,为什么呢?
<img src="<%=basePath%>view/images/<s:property value="cloth.images"/>"还有这个警告一直跟着我不放:2011-7-6 14:38:16 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: No configuration found for the specified action: 'manager/addCloth.action' in namespace: '/manager'. Form action defaulting to 'action' attribute's literal value.
请高手出招....
Invalid field value for field "cloth.clothPrice".
但我的代码是下面:
<field name="cloth.clothPrice" >
<field-validator type="regex">
<param name="expression"><![CDATA[^[0-9]*$]]></param>
<message>衣服价格必须是数字..</message>
</field-validator>
</field>
还有个问题,也是在同一个页面,还没有进行校验的时候下面的路径图片是可以显示出来的,但我输入不符合校验时,按提交,由于校验不正确所以跳回原页面时,图片既然显示不出来了。在页面测试时,发现开<s:property value="cloth.images"/>没有值输出,为什么呢?
<img src="<%=basePath%>view/images/<s:property value="cloth.images"/>"还有这个警告一直跟着我不放:2011-7-6 14:38:16 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: No configuration found for the specified action: 'manager/addCloth.action' in namespace: '/manager'. Form action defaulting to 'action' attribute's literal value.
请高手出招....
解决方案 »
- 回答就有分!springmvc的例子在调用action时spring注入成功,但是在访问时注入的东西是null
- servlet问题
- 访问sqlserver2005 数据库
- 哪位大侠知道struts2标签中 % # $ 的用处与区别,给讲解一下,谢谢了
- 为什么我在TOMCAT下正常运行的程序,在RESIN下无法正常工作,是WEB.XML的问题么?急,在线等!
- oracle连接
- 用lomboz做Servlet的时候那个web.xml是自动生成还是自己手动写的?
- 专业英语问题(2)-infrastructure
- 关于JDBC数据库连接的问题:请进来看看
- 在Jbuilder7中怎样连接oracle数据库
- Maven Central 无法使用。
- servlet3标签定制的问题
ognl.MethodFailedException: Method "setClothPrice" failed for object org.whj.entity.Clothor@11a9310 [java.lang.NoSuchMethodException: org.whj.entity.Clothor.setClothPrice([Ljava.lang.String;)]
我定义的clothPrice的double型的...应该怎么改?
要么再新添加一个String类型做中转 将你的double的值转成String 赋给这个新建的String
页面用这个新的String就行了
新建一个 String clothPrices
你可以在页面返回前 给每个对象设置这个clothPrices 属性 setClothPrices(clothPrice .toString)
也可以将clothPrices 的get方法 修改为 return clothPrice .toString;