Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

displaying error message but not validating

 
sure nandu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sure nandu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there was also mistake in 'validwhen' field
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic