• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 validation problem

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help me thanks in advance
hi iam using struts2 validation.xml for validating the form some times the action is directly submitted witout validating

the validation is not working.this is the code in struts.xml

<action name="AddRegistration" method="addAcceptRegistrationForm"
class="registration.action.RegistrationAction">
<interceptor-ref name="defaultStack">

</interceptor-ref>
<result name="input" type="redirect">/Resources/registration/addRegistrationForm.jsp</result>
<result name="error">/Resources/registration/Error.jsp</result>
<result>/Resources/registration/Success.jsp</result>
</action>



and one more problem which i already posted earlier was the old errors are not getting cleared instead it adds up iam not using springs is there any suggestion what the changes i need to make or where can i remove the old errors
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off, the input page should not be a redirect. If you're not using Spring (singular) I don't see how errors could accumulate, since an instance is created per-request--you're going to need to supply more information. When you do, please make sure you UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.
 
praveen moturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for reply


what additionaly information is needed sorry i cant understand iam extending action support class for my action class
and validation.xml in which iam validating my form fields

there are some select boxes in which required vlidation is not working but iam trying other way as min length validation for that

my code is as follows

validator.xml

<field name="registrationFormBean.nationalityId">
<field-validator type="int">

<param name="Min">1</param>
<message> Nationality Is Required </message>
</field-validator>

jsp code follows


<s:select name="registrationFormBean.nationalityId"
list="#session.NationalityList"
listKey="nationalityId"
listValue="nationalityName"
headerKey="0"
headerValue="---select---"
label="Ntionality" />


the field nationlityId in the bean is of type int

even though i try to validate the field with required it is not validating thats why iam using min length validator instead of required

on more important thing is old errors are not clearing up in the jsp ,the message are adding up


can any please explian to solve the issue i might i have missing some thing is there any additional information i need to post for more clarity



 
You can thank my dental hygienist for my untimely aliveness. So tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic