File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "public static interface for application variables" Watch "public static interface for application variables" New topic
Author

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?

Thanks,
Earl

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: public static interface for application variables