velocity-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zhukaiyun" <kaiyun-...@kcss.com.cn>
Subject help:Velocity.setProperty
Date Thu, 06 Dec 2007 03:53:12 GMT
Hello,
        I'm integrating Velocity into an existing app, and need help with
the
way
the Velocity object is initialized. I understand that it is a singleton, and
that calling init() repeatedly will have no effect. However, I was surprised
that the following code also doesn't work as one might think:

        org.apache.velocity.app.Velocity.Velocity.init();
                Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH,
"foo");
                Object o1 =
Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH);
                Velocity.clearProperty(Velocity.FILE_RESOURCE_LOADER_PATH);
                Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH,
"bar");
                Object o2 =
Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH);


o1 and o2 both end up being "." ... which is apparently the default value
from calling Velocity.init(). So, do I understand that there is no way to
set the properties after the first call to .init(...)? In my application, I
would like to set Velocity.FILE_RESOURCE_LOADER_PATH every time before I
call .merge. Is this possible, as Velocity is, or do I need to customize it?
If I need to customize it, has anybody made this change already, and what is
the  <http://osdir.com/ml/jakarta.velocity.user/2003-08/msg00082.html> best
method to do so? My first thought would be to destroy Velocity
object and create it new each time. Thanks for your thoughts,






-----------------------------------------------------------------
京瓷信息系統(上海)有限公司
    朱 開雲
〒201203 上海張江高科技園区郭守敬路498号浦東軟件園19号樓1樓
TEL 0078-86-21-5080-5660 内線8871-146
FAX 0078-86-21-5080-5759
-----------------------------------------------------------------




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message