[Logo] Mentawai Recipes
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Moderation Log] Moderation Log   [Register] Register / 
[Login] Login 
Accessing the action context from a POJO action  XML
Forum Index » Official Recipes
Author Message

Joined: 10/01/2008 08:20:15
Messages: 39

With Mentawai you can code simple POJO actions that have ZERO coupling with the framework.

The action context I am talking about is: Application, Session, Input, Output, Cookies, Locale, Headers, Method (POST or GET), Messages, Errors and Field Errors. For each one of these, there is a filter that you can use to inject a corresponding value or data structure inside your model.

Here is an example of all these filters:

Now, inside you POJO action, you can do this:

Feel free to add all these filters to your application, even if your actions do not need all of them. That's because these filters are all PULL filters, in other words, the objects are instantiated and injected if and only if the Actions have them as properties.

Another option is to use the ActionContextFilter that can place a single Map<String, Object> with everything. Take a look:

Now inside your action you can do:

Note that your action is completely decoupled from any framework class.
Forum Index » Official Recipes
Go to:   
Powered by JForum 2.1.8 © JForum Team