This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2 newbie: Custom configuration parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 newbie: Custom configuration parameters" Watch "Struts2 newbie: Custom configuration parameters" New topic

Struts2 newbie: Custom configuration parameters

Eric Ases

Joined: Nov 17, 2010
Posts: 4

Hello, I have just started with Struts2, and am trying to pass in custom parameters to my app. This includes mostly text strings like the site name, special email addresses, directories, various flags that are used in the app, etc, so that it can be easily changed out. In my current non-Struts system, I have them in an XML file that I read in on startup with a custom file reader. Is there a way to pass in custom information like this in a Struts way?

I have searched around, but all of the examples I've seen relate to Struts-specific parameters that can be setup via struts.xml or other property files. Thanks!
Joe Ess

Joined: Oct 29, 2001
Posts: 9191

Welcome to the JavaRanch.
Struts is an implementation of the Front Controller pattern. It doesn't care about how you configure your application.
The "servlet" way to do it would probably be to use servlet parameters. If you have many parameters and don't want to pollute web.xml, using properties files or the XML strategy you've used before is fine.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Struts2 newbie: Custom configuration parameters
It's not a secret anymore!