-1

for example, EditAction has the Object proposal, how to user Struts validation framework to validate the fields of proposal. Annotation or XML configuration?

<s:form action="/process/sample/Edit" >
  <s:select name="proposal.study" label="Study" list="#attr.studyTypeListKey" multiple="true" size="3" required="true" />
  <s:textfield name="proposal.familyNumber" label="Family Number" maxlength="20" required="true"/>
  <s:textfield name="proposal.individualNumber" label="Individual Number" maxlength="10" required="true"/>
  <s:textfield name="proposal.alpha" label="Alpha" maxlength="30" required="true"/>
  <s:submit value="Modify"/>
</s:form>
6
  • are you asking about the differences between annotation validation and xml config validation and which to use?
    – nmc
    Sep 19, 2012 at 19:17
  • it seems that neither of them can be used. As a annotation should added to a particular field and "field name" as well. proposal is the field in action, it has getter and setter, but I want to validate the fields of proposal like proposal.familyNumber.
    – Jenny
    Sep 20, 2012 at 0:52
  • I know the documents, but it tells nothing about my problem.
    – Jenny
    Sep 20, 2012 at 0:53
  • @nmc could you help me?
    – Jenny
    Sep 20, 2012 at 1:01

1 Answer 1

0

Please try this code . It may be Work .

  1. Please Check your xwork jar version and Struts-core jar . It should be same .

  2. Field name and Textbox name should be same .

1
  • <s:form action="customer.action" method="post" validate="true"> may be its work
    – sumit
    Jun 12, 2014 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.