This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes public static interface for application variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "public static interface for application variables" Watch "public static interface for application variables" New topic

public static interface for application variables

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Im not sure if this is the correct design approach. But here goes.

I have a public class GlobalActionSupport extends ActionSupport which is implemented by every other action so I have sort of a global action going on. If I want to implement mail I use a class called public class WebMail extends GlobalActionSupport

That being said I have noticed in my design that I use application variables in almost every page so I wanted to alter GlobalActionSupport with a public static interface so I dont have to call and import ActionContext into every action I need it.

This is what I tried to implement.

On the line that has String changeCadence( app.get("KEY_ENTITYID") ); eclipse says "Syntax error on tokens, AnnotationName expected instead" any ideas why?

Does this approach seem OK? instead of calling ActionContext.getContext() in every Action that I need an application variable?


Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Use applicationAware interceptor.

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
subject: public static interface for application variables
Similar Threads
Problem getting attributes from request in Struts2
need to transfer productID from url to action class in struts 2
unable to exceute logout program
Import statement problems
JAAS with JBOSS and Struts2