• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 Validation problem

 
praveen moturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi iam new to struts2 . iam using Xx-validation.xml while validating the fields are getting validated
but each time a new a message is added for the same field
for example name
message : Enter your name
when i submit the page without giving any value in the name field
this time i will get two error messages
Enter your name
Enter your name

can any please help me
 
Maneesh Godbole
Saloon Keeper
Posts: 11178
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,
Welcome to the Ranch.

We have a dedicated forum for Struts. I will move this thread there for you.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using Spring? If so, your actions should be "prototype" scope--actions are expected to be created per-request.
 
praveen moturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
praveen moturi wrote:hi iam new to struts2 . iam using Xx-validation.xml while validating the fields are getting validated
but each time a new a message is added for the same field
for example name
message : Enter your name
when i submit the page without giving any value in the name field
this time i will get two error messages
Enter your name
Enter your name

can any please help me



i am using struts2.x with hibernate


my problem is that in the jsp when i submit again without entering any thing in required field this time two messages
will be displayed like "field require" "field required"
for the third time "field require" "field required" "field required"
validation is working instead of one message the messages are getting piled up
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My original question remains unanswered.
 
Kev Adams
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David, this is exactly the problem I was having as well, and yes, *I* am using Spring. I set the bean to use 'scope="prototype" ' and it worked perfectly.

Thanks a bunch.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At least it helped *somebody* ;)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic