wood burning stoves 2.0*
The moose likes Struts and the fly likes How to handle global parameters in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to handle global parameters in Struts " Watch "How to handle global parameters in Struts " New topic
Author

How to handle global parameters in Struts

Rishi Singh
Ranch Hand

Joined: Dec 09, 2000
Posts: 321
Hi All,
I have not fully explored Struts , though we have modified the required components as per our requirements and using it, I would like to know how to handle global parameters in Struts which are used for almost every other request/response .
As per Struts,Request handlers are cached by Request processors when first created and subsequently made available to other incoming request.So is there a global configuration object which is polled and made available to the request handler when required.Would like inputs from people using it and Ted...
Rishi Singh
SCJP,SCWCD
Ted Husted
Author
Ranch Hand

Joined: Dec 02, 2002
Posts: 37
Generally, you would just tuck that away in the application (or servlet) context under a predetermined name. The Struts tags (and Velocity View tools) will check all the scopes for any object referenced in a presentation page.
Within in an Action, you can access the object directly. The Controller servlet is provided as a member variable, so you have access to all the servlet methods.
In Struts 1.0, a helper servlet was often used to load such parameters (though you could also subclass the ActionServlet if you wanted). In Struts 1.1, there is a PlugIn interface for Actions, which you can use to load global resources like this.
HTH, Ted.


<a href="http://husted.com/struts/book.html" target="_blank" rel="nofollow">Struts in Action</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle global parameters in Struts
 
Similar Threads
Issue with multiple JVM instances on WAS61, could some one please help me out?
Spring & Struts - loading spring exception class from struts-config.xml
File upload only handles .txt documents??
When to release JDBC resources?
enctype="multipart/form-data" request.getParameter() issue