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 displaying error message but not validating Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "displaying error message but not validating" Watch "displaying error message but not validating" New topic
Author

displaying error message but not validating

sure nandu
Greenhorn

Joined: Oct 16, 2006
Posts: 18
hello everybody,

iam doing validation using Struts validator.(validation.xml) i have a jsp page with 3 buttons add,edit,delete.
i have one field department. i have used DispatchAction with three methods
add,edit,delete. if i press add button i will send a "add" value from jsp page with <html:hidden>. this will call add method of DispatchAction.
which inturn add department field to persistent store and go back to my jsp page.

when i donot give any value in department field IT WILL SHOW ME THAT DEPARTMENT FEILD IS REQUIRED.BUT THE ADD METHOD OF MY DISPATCHACTION GETS CALLED AND BLANK VALUE IS ENTERED IN DATABASE.ACTUALLY ADD METHOD OF DISPATHACTION MUST NOT GET CALLED.

if any one has faced similar problem please tell me the solution.

thanks in advance.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Something must be wrong with your setup of the Struts Validation Framework for this page. Please show us relevant portions of the code in your JSP, particularly the submit button, and any JavaScript functions that get called. Also show us the relevant portion of your validation.xml file.


Merrill
Consultant, Sima Solutions
sure nandu
Greenhorn

Joined: Oct 16, 2006
Posts: 18
hai Merrill Higginson,

actually i had done mistakes in my jsp page(i had given action wrong). your suggestion helped me a lot. thanks a lot.
sure nandu
Greenhorn

Joined: Oct 16, 2006
Posts: 18
there was also mistake in 'validwhen' field
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: displaying error message but not validating