velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Wright" <ken...@ukonline.co.uk>
Subject RE: Properties File
Date Mon, 19 Jul 2004 17:38:25 GMT
Thanks Tomas,

I've tried your suggestion - no joy.

Does this help ... I've added this code:

        if ( propsFile != null )
        {
            String realPath = getServletContext().getRealPath(propsFile);
        
            if ( realPath != null )
            {
                propsFile = realPath;
	    // I added all the following System.outs
                System.out.println("=========");
                System.out.println(config.getInitParameter("properties"));
                System.out.println(propsFile.length());
                System.out.println("|" +
getServletContext().getRealPath(propsFile) + "|");
                System.out.println("=========");
            }

            p.load( new FileInputStream(propsFile) );
	
	// I added this next line
            p.list(System.out);
        }

The output is:

~~~~~START~~~~~
=========
velocity.properties
85
|C:\Program
Files\Tomcat\jakarta-tomcat-4.1.30\webapps\velexample2\C:\Program Fi
les\Tomcat\jakarta-tomcat-4.1.30\webapps\velexample2\velocity.properties|
=========
-- listing properties --
file.resource.loader.path=templates
runtime.log=velocity.log
SampleServlet : template not found
org.apache.velocity.exception.ResourceNotFoun
dException: Unable to find resource 'sample.vm'

(there might be some wrapping in there...)

Ken






In your message dated Sun, 18 Jul 2004 18:32:31 -0400, Tomas said...

> Try this...
>  
> ---8<----SampleServlet2.java----
>     {
>         /*
>          *  get our properties file and load it
>          */
> 
> //        String propsFile = config.getInitParameter(INIT_PROPS_KEY);
>         String propsFile = config.getInitParameter("properties");        
>         Properties p = new Properties();
>         
>         if ( propsFile != null )
>         {
> --->8----SampleServlet2.java----
> 





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


Mime
View raw message