This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

handling errors vs. warnings in Struts 1.38  RSS feed

 
Chuck Emmons
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am writing an application that requires erroneous user input to be a "hard error" for user class A, but only a warning for user class B.

I have searched high and low for how to handle this, and came across the following "best practices" below.

1. To display the error messages of different categories, define these categories such as FATAL, ERROR, WARNING, or INFO, in an interface.

2. In the Action or form-bean class, you can then use the following:
  • errors.add("fatal", new ActionError("....")); or
  • errors.add("error", new ActionError("....")); or
  • errors.add("warning", new ActionError("....")); or
  • errors.add("information", new ActionError("...."));
  • saveErrors(request,errors);


  • 3. To display them according to those categories, use the following code:


    I am assuming that the interface mentioned above would be an interface to the ActionMessages class and that the category definitions would just be static variables in the interface. Is this the case? I need to have a way of determining if the collection contains actual errors at submittal to handle the "hard errors" or just display the warnings.

    Any advise would be greatly appreciated.

     
    David Newton
    Author
    Rancher
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Anything recommending defining constants in an interface should probably be considered outdated, at least in terms of that.

    As far as determining what the collection contains--it seems like you already are, with the messagePresent tag, no? I'm a little confused as to what the actual question is.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!