File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts2 Validation problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Validation problem" Watch "Struts2 Validation problem" New topic
Author

Struts2 Validation problem

praveen moturi
Greenhorn

Joined: Aug 20, 2009
Posts: 4
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

Joined: Jul 26, 2007
Posts: 10355
    
    8

Praveen,
Welcome to the Ranch.

We have a dedicated forum for Struts. I will move this thread there for you.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you using Spring? If so, your actions should be "prototype" scope--actions are expected to be created per-request.
praveen moturi
Greenhorn

Joined: Aug 20, 2009
Posts: 4
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

Joined: Sep 29, 2008
Posts: 12617

My original question remains unanswered.
Kev Adams
Greenhorn

Joined: Oct 27, 2009
Posts: 23
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

Joined: Sep 29, 2008
Posts: 12617

At least it helped *somebody* ;)
 
wood burning stoves
 
subject: Struts2 Validation problem