My Grails app displays information message for the user after the request process, these are usually either success messages: / P>
User "John@example.com" successfully created
or error message:
Please check the verification shown below Fix Errors
If I do a redirect after request processing I am then stored in the message flash scope. But if I call the
render after processing the request, then I can not store messages in flash scope, because the message will be very much present for a request in a flash scope, therefore I'm not sure what is the best way to see these messages from the controller?
An obvious option is to pass them in the model with just other data, but I like to keep these messages different from the "real" visual model, are there any alternatives?
In the case of the example shown above, where I want to show an error message related to a command object, call it when I call it "Please correct ...." Code for, is it the misuse of the concept of global errors?
Did you consider using session objects? When I have the information that needs to live for many requests but it does not need to be maintained then I usually store it as an object in session object. It can be easily accessed by controllers or ideas.
Comments
Post a Comment