English 中文(简体)
铁路信息
原标题:Grails informational messages

我的铁路公司在处理请求后向用户展示信息。 这些通常是成功的信息:

成功创建的用户“John@example.com”

或错误信息:

Please fix the validation errors shown below

“error

如果我处理请求后再回头,那么我就会把电文放在闪电范围内。 但是,如果我在处理请求后打电话到render,那么我就可以将电文放在闪电范围内,因为这样一来,电文就会在闪电范围中存在太多,因此我不敢肯定从控制方传递这些电文的最佳方式是什么?

一种明显的选择是将这些信息与其他数据一起输入模型,但我倾向于将这些信息与“real”观点模式分开,是否还有其他选择?

在上述例子中,我想显示与指挥物体有关的错误信息,我认为这是“。 Errors.reject(msgCode)通过“请固定......电文”守则,这是否滥用了全球错误概念?

问题回答

Have you considered using the session object? When I have infoermation that needs to live for multiple requests but does not to be persisted I usually store it in the session object as an objecct. This can easily be accessed from controlers or views.

我认为,这一问题在一次数据原始网站上得到了解决。

Have you tried putting your data in the request object?





相关问题
Groovy - how to exit each loop?

I m new to Grails/Groovy and am trying to find a node in a an xml file; I ve figured out how to iterate over all of them, but I want to exit the loop when the target node is found. I ve read that ...

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example, ...

How can I get this snippet to work?

I d like to port a little piece of code from Ruby to Groovy, and I m stuck at this: def given(array,closure) { closure.delegate = array closure() } given([1,2,3,4]) { findAll { it > 4} ...

Changing the value in a map in Groovy

This is about a very basic program I m writing in Groovy. I have defined a map inside a method: def addItem() { print("Enter the item name: ") def itemName = reader.readLine() print(...

Is functional Clojure or imperative Groovy more readable?

OK, no cheating now. No, really, take a minute or two and try this out. What does "positions" do? Edit: simplified according to cgrand s suggestion. (defn redux [[current next] flag] [(if flag ...

热门标签