I have a form with three fields, two lines (one select box and a text box) and int. When I put a letter or something other than int (52.4 or aaa) in the field, I received an error that I cannot "catch", my choice disappears and in the message box I got a message from my xalification file validation (in French) and another in English (I suppose sent by racks).
error in tomcat:
(ognl.OgnlValueStack 60 ) Error setting expression 'userSize' with value '[Ljava.lang.String;@14aa6c3'
error in message box:
Invalid field value for field "userSize".
test size
JSP Code:
<s:form action="sendUserCreation" method="POST">
<s:action namespace="/" name="civilityPicklist" executeResult="true"/><br />
<s:textfield name="lastName" /><br />
<s:textfield name="userSize" /><br />
struts.xml code:
<action name="createUser">
<result>/jsp/user/create.jsp</result>
</action>
<action name="sendUserCreation" class="fr.action.UserAction" method="createUser">
<result>/jsp/splash.jsp?messKey=${messKey}</result>
<result name="input">/jsp/user/create.jsp</result>
</action>
<action name="civilityPicklist" class="fr.imaps.oxygene.portal.action.CivilityPicklistAction">
<result>/jsp/user/civilityPicklist.jsp</result>
</action>
UserAction-validation.xml code:
<validators>
<field name="userSize">
<field-validator type="conversion">
<message>test size</message>
</field-validator>
</field>
</validators>
UserAction Code:
private int userSize;
public int getUserSize() {
return userSize;
}
public void setUserSize(int userSize) {
this.userSize = userSize;
}
I thought the type of conversion check would catch this problem, but it seems not ... what happened to my code?
source
share