Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionErrors from Action Class are not displaying in struts jsp page

 
vamsi mummadi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
Iam facing problem while displaying ActionError messages.
Error messages from ActionForm validate method are displaying properly but from Action class iam creating some errors those things are not displaying in my Jsp page.
Iam sending my code please try to solve my problem

code:
in Action class

errors.add("MOU Number",new ActionError("errors.notavailable",mou_no));

if(!errors.isEmpty())
{
saveErrors(req,errors);
}

in Application Resources

errors.notavailable=MOU Number {0} is already exist in the Data Base.

in Jsp page iam displaying these errors by
<html:errors/> tag

and in my struts-config.xml iam setting validate and input attributes.

Iam not getting where i made mistake ActionForm validate method case is working fine but this case is not working

Please Help me
 
sai kinnera
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("errors.notavailable",mou_no));

in the action class
 
vamsi mummadi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that still iam not getting the error message in jsp. but errors are adding into that ActionErrors object but iam not getting why they are not displaying.
please help me
 
sai kinnera
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then it's a problem with your ApplicationResources file, where you have your error messages. Could be a configuration issue. The application is not reading the error messages.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm...looks pretty good to me. Also, I think if your forward has redirect set to true, you will loose the error messages. That might be worth checking.

- Brent
 
vamsi mummadi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you its working i set redirect to false then iam getting those error messages.
thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic