struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject confused about validation
Date Mon, 02 Apr 2007 01:23:22 GMT
Hello everyone:
I am totally new to struts. I decided to go with struts 2. But the 
documentation is not complete, and I believe alot of you may agree with me.

The example on this page  says that the 
validation file follows the name convention  SomeAction-validaton.xml. 
In the field validation example in the showcase application in struts 2 
distribution,  the name of the file is struts-validation.xml. Now, none 
of the examples are working for me basically because none of them is 
complete. The one in the show case is great but there no explanation for 
the code.
For example what is the name space here in struts applications ?

Can some one look into what I did and advice me what to do next ? I have 
a webpage called newAccount.jsp:

<%@ taglib prefix="s" uri="/struts-tags"%>
<s:form action="createAccount"   >
<s:textfield name="firstName" label="First Name" required="true"  
<s:textfield name="lastName" label="Last Name" />

I need to validate the fields in this page, so I did this in 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"

    <field name="firstName">
        <field-validator   type="requiredstring">
            <message>first name is required</message>

and in my struts.xml I did this:

        <action name="createAccount"  class="billing.Account">
            <result name="SUCCESS">/pages/accountView.jsp</result>
             <result name="ERROR">/pages/exception.jsp</result>

but nothing is happening and no validation is taking place. can any one 
kindly recommend something?

Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message