[opencms-dev] Fighting with Global VARs and Configs

Anatol opencms at recordcaster.de
Fri Dec 16 12:02:14 CET 2005


Hi All!

I just develop a complex webapp and have many params which I need in 
many JSPs. For example: CONTENT_DIR, IMAGE_DIR, ARTICLE_CONF, 
HEAD_WIDTH, FOOT_HEIGHT, etc.
Some params are absolute terms, but some have to calculate for every 
pagerequest.

What is the best way to configure theses constant VARs: within a 
XmlContentFile (very user friendly! :) but what says the performance? ) 
or in a simple textfile like:
----
...
String HEAD_WIDTH = "500";
String FOOT_WIDTH = "500";
String HEAD_HEIGHT = "200";
String FOOT_HEIGHT = "100";
String FOOT_COLOR = "#AA13BC";
...
----

And what is the best way to import these VARs into the several JSPs?

The <%@ include file="all_the_vars_file" %> is very unhandy, cause if I 
change a line in the included file "all_the_vars_file", I've to reopen 
and save all the files used the file "all_the_vars_file". Upto 3 files 
no problem ;) but I've round about 30 files (or more?) in diffrent 
folders - very unlovely ;)
A second problem is, it seems I can only include relative pathnames :/

The other way <cms:include file="all_the_vars_file"> works here for the 
first view much better. Changing the VARs in "all_the_vars_file" and 
including is plain sailing. But: to access the VARs is very ugly :( The 
cms:included file have their own namespace. So all the VARs I've to fire 
into the request ( request.setAttribute("VAR_NAME", VAR_VALUE);  ). And 
in every JSP needing some VARs I 've to fishing in the request for them. 
( request.getAttribute("VAR_NAME") ) That results in inflated 
request.getAttribute-Blocks.

How to solve that? Have you any idea? Many thanks!
Anatol



More information about the opencms-dev mailing list