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
http://struts.apache.org/2.0.6/docs/validating-input.html 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>
<s:textfield name="lastName" label="Last Name" />
</s:form>
I need to validate the fields in this page, so I did this in
Account-Validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="firstName">
<field-validator type="requiredstring">
<message>first name is required</message>
</field-validator>
</field>
</validators>
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>
</action>
but nothing is happening and no validation is taking place. can any one
kindly recommend something?
Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]