You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ryan Norman <ra...@mminternet.com> on 2002/05/15 23:32:47 UTC

Keeping Constants Outside The Java/JSP Source File

Hi,

I am Ryan Norman.

I am running Win 2K advanced server, tomcat 4.0, struts, oracle.

I have a bunch of constants that I would like to keep outside the Java/JSP source file. 
Because when I am done, I would like to upload my files to my client place where there is nobody to change and recompile it.
Is there a way to keep the constants in the XML file or in a .ini file (like how we do in windoze development) when I use tomcat and struts. 

Thanks in advance

Ryan Norman


Re: lajug - Keeping Constants Outside The Java/JSP Source File

Posted by Victor Hadianto <vi...@nuix.com.au>.
On Thu, 16 May 2002 08:18, you wrote:
> I believe you can put them inside a property file as part of your WAR.
> Is that what you mean?

That will work, or you can do this as well:

On your web.xml fle declare:

    <!-- Environment variable -->
    <env-entry>
        <description>My variable description</description>
        <env-entry-name>myVariable</env-entry-name>
        <env-entry-value>/usr/local/bin/stuff<env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

and from any of your servlet/action classes you can do the following to 
retrieve the variables:

Context context = new InitialContext();
stuff = (String) context.lookup("java:comp/env/myVariable");


Regards,

-- 
Victor Hadianto
---------------
And in the heartbreak years that lie ahead, Be true to yourself and the 
Grateful Dead. -- Joan Baez

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: lajug - Keeping Constants Outside The Java/JSP Source File

Posted by Christopher Smith <x...@xman.org>.
I believe you can put them inside a property file as part of your WAR.
Is that what you mean?

--Chris

On Wed, 2002-05-15 at 14:32, Ryan Norman wrote:
> Hi,
> 
> I am Ryan Norman.
> 
> I am running Win 2K advanced server, tomcat 4.0, struts, oracle.
> 
> I have a bunch of constants that I would like to keep outside the Java/JSP source file. 
> Because when I am done, I would like to upload my files to my client place where there is nobody to change and recompile it.
> Is there a way to keep the constants in the XML file or in a .ini file (like how we do in windoze development) when I use tomcat and struts. 
> 
> Thanks in advance
> 
> Ryan Norman
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>