tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject RE: web.xml
Date Mon, 06 Dec 2004 14:50:34 GMT
we have objects that statically (and lazily) load properties from databases and files and it
works great. we have a context listener so we can clean up after ourselves. it means we don't
rely on managing context-params and storing them somewhere for the rest of our app.

> -----Original Message-----
> From: Andreas Andersson [mailto:andreas@travelstart.se]
> Sent: 06 December 2004 14:48
> To: Tomcat Users List
> Subject: Re: web.xml
> 
> 
> Allistair Crossley wrote:
> 
>  > you should be acquiring your config params in the way I 
> show, and then
>  > setting them perhaps in the application scope, or maybe a 
> registry, or
>  > whatever pattern you wish. but do not make your "normal" classes
>  > attempt to access any objects like servletconfig or 
> otherise as that
>  > breaks good design.
> 
> In my opinion configuration classes should be static, just reading a 
> configuration file from the system in a static environment. 
> That makes 
> it difficult to set parameters from the .jsp-pages or servlets.
> 
> 
> 
> VAN DER MARLIERE FREDERIC wrote:
>  > Hi Andreas.
>  >
>  > You can get you parameter with:
>  >
>  
> >'request.getSession().getServletContext().getInitParameter("C
> ONFIGFILE")'
>  >
>  > It first gets a reference on your application context and then gets
>  > the parameter you wrote in <context-param>...</context-param>
> 
> Again, this all depends on a jsp-page. Perhaps the way to go 
> is to have 
> the config class nostatic and in the application scope.
> 
> What is "best practise"?
> 
> -- 
> Andreas Andersson
> IT Dept.
> Travelstart Nordic
> andreas@travelstart.se
> http://www.travelstart.se
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message