2

I am trying to do validation on a Map using struts 2. When I click on the submit button, the error message will always appear even though I have inserted a value into the textbox. Is there anyway for it to work? Any help will be much appreciated. The following is my file

In my new.jsp

<s:textfield name="myObject.myMap['name']" key="name" ></s:textfield> 

In the validaton.xml

<validators> 
   <field name="myObject.myMap['name']"> 
      <field-validator type="requiredstring"> 
        <message key="errors.required"/> 
      </field-validator> 
   </field> 
</validators>
  • Is myObject.myMap['name'] rendering a value from entity? There might be some conversion error happening before validation interceptor and it is giving NULL value to the validator. – batbaatar Mar 02 '12 at 14:11
  • I have tried submitting without going through the validator and I am able to save the value into the database with auto injection. So I do not think it is returning null – Noemi Evins Mar 05 '12 at 09:03
  • Is your validate() method empty? Also, can you show us your interceptors stack? – batbaatar Mar 05 '12 at 10:38

0 Answers0