Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

errors.add() question

 
pradeep arum
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I want to display errors directly without writing key, value pairs in the properties file, i want to pass a string of my choice to errors.add("fatal error ") and make the <html:error> pick up the error and display on the JSP page, i know there is a way with message resource in the web.xml, but i am not sure.please help.
thanks
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that can be done without extending the framework.
You could always cheat and do:
ApplicationResources:
error.x = {0}

Action:
errors.add("x", new ActionError("error.x", "Don't do that again!");
 
pradeep arum
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i thoutght of this idea before, but i dont want the properties file.
thanks
Pradeep
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I said you'll have to extend the framework.

One way to do it is from MessagesTag. In the doStartTag() method find this:

and turn it to this:
String msg = report.getKey();
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pradeep

I agree with marks idea of substitution if u use properties but if u overwrite the tag as he said that will make u loose the original behaviour of errors tag so better extend as i wrote in another post
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic