HI
I hope that this will help you 

http://struts2issues.blogspot.com/

BR,
sanj
-----Original Message-----
From: Pranav [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 24, 2008 6:32 AM
To: user@struts.apache.org
Subject: Problem with Validation framework

Hi All,

I am having a problem with validation framework. This is the first time I am
trying to use struts2 validation. Here's different code pieces that I have.

######## UserLookupAction-validation.xml

<validators>
    <field name="memberId">
        <field-validator type="requiredstring">
           <message>You must enter a value for Member ID.</message>
       </field-validator>
       <field-validator type="stringlength">
             <param name="maxLength">20</param>
             <message>
                 Member ID cannot contain more than 20 characters
             </message>  
         </field-validator>
    </field>
</validators>


########### finduser.jsp

<s:head theme="ajax"/>
  <body>
      <s:form
            id='MemberInputForm'
            action='LookupUser'
            method='post'
            theme="ajax"
            validate="true">
           <table>
           <tr>
                <td>Find user record by Member ID: </td>
                <td><input type='text' name='memberId' value=''></td>
                <td><s:submit value="Find User" theme="ajax"
targets="userDetailsDiv" onLoadJS="initializeAppDropdowns(data,
type)"/></td>
           </tr>
           </table>    
      </s:form>
      <div id='userDetailsDiv' style="border: 1px solid #FF9900"><b>initial
content</b></div>
  </body>

########## struts.xml

<action name="LookupUser"
class="com.intuit.sbfw.action.mc.UserLookupAction">
      <result name="input">/html/finduser.jsp</result>
       <result>/html/finduserResult.jsp</result>
</action>


Notes:
1) My package extends from struts-default and so I am using the
defaultStack.
2) My Action class UserLookupAction extends from ActionSupport class.

Questions:
1) I am not seeing any validation error even when i leave the memberId as
blank. The log file does not say anything at all. Is it because I am using
theme as "ajax"?
2) I see this message when I invoke my very first action: INFO
[ActionValidatorManagerFactory] Detected AnnotationActionValidatorManager,
initializing it...
Does this mean that I have to use Annotation only to configure the
validation rules and I cannot use the xml approach?
3) What could be wrong with my setup so that my validation classes are not
working?

Thanks
Pranav




 
____________________________________________________________________________
________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to