hi Martin,

I here, do not use Spring nor hibernate and indeed need defining a ServletContextListener implementation that I configure in web.xml that initializes database connections etc.

In an ideal world:
- You are starting a new web application project from scratch
- You are open to see best practices and learn by example
- You do not have constraints on which technologies to use (e.g. Spring, Hibernate, Sitemesh, etc)

THEN

Please do yourself a favor an use AppFuse, it will give you a beautiful Struts 2 application setup out of the box including user-management and authentication on top of MySQL database. The only thing I can complain about it though is its usage of sitemesh where I prefer tiles. Maybe their GenericDao implementations could be polished as well.

Checkout their web site: http://appfuse.org/display/APF/AppFuse+QuickStart

Basically you only need to:
1) Install maven & subversion & MySQL
2) mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases^ -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject
3) cd myproject and execute "mvn appfuse:full-source"

Then you can start a full forensic analysis on it :) and get the idea how to structure a beautiful web app :) they even offer a tutorial how to get you going from that point on.

HTH,
regards,
Giovanni

[EMAIL PROTECTED] wrote:
Hi,

I am new to Struts2 and stumbling immediately.

I want to have an initialization routine in my web app which will connect to a 
data base etc. at startup time. This routine needs some parameters (e. g. the 
path of a config file to be read). How can I access such external information?

With Servlets I would normally implement a ServletContextListener which would 
get its information as an init-param from web.xml.
But for Struts2 there is no <servlet> spec where I could put it.

Writing Struts1 applications I typically utilized a plugin which could read 
parameters from struts-config.xml. Maybe this is still possible, but the 
Struts2 plugin mechanism seems to be too powerful (or just overwhelming) for me.

What is the preferred way?

Thanks

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to