You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vijay K Anand <r1...@freescale.com> on 2005/07/11 15:40:25 UTC

Propertirs file

Hi All

I have a common class which gives value for keys in the properties file. 
How do i load / read values from properties file?


Regards
Vijay

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


Re: Propertirs file

Posted by Leon Rosenberg <st...@anotheria.net>.
Ok, example code
		Properties props = new Properties();
		try{
	
props.load(MyClassName.class.getResourceAsStream("/mail.properties"));
		}catch(IOException e){
			log.error("load properties", e);
		}
		
		resServer   = props.getProperty("mail.smtp.host");
		resUser     = props.getProperty("mail.smtp.user");
		resPassword = props.getProperty("mail.smtp.password");
		resDebug 	= props.getProperty("mail.smtp.debug"); 

The file should be in classes dir of the web (or anywhere else in the
classpath)

> -----Ursprüngliche Nachricht-----
> Von: Vijay K Anand [mailto:r1631z@freescale.com] 
> Gesendet: Montag, 11. Juli 2005 16:21
> An: Struts Users Mailing List
> Betreff: Re: Propertirs file
> 
> Hi
> i need to load LDAP server name , port , username from prop 
> file . how this will help us?
> 
> Thanks replying to the mail
> 
> Wendy Smoak wrote:
> 
> >From: "Vijay K Anand" <r1...@freescale.com>
> >
> >  
> >
> >>I have a common class which gives value for keys in the 
> properties file.
> >>How do i load / read values from properties file?
> >>    
> >>
> >
> >Many of the Struts tags have attributes such as 'altKey' 
> 'errorKey' and 
> >'styleKey' which will look to (usually) 
> ApplicationResources.properties 
> >to retrieve a value.
> >
> >If you meant Properties in general...
> >http://java.sun.com/docs/books/tutorial/essential/attributes/
> properties
> >.html
> >
> >  
> >
> i need to load LDAP server name , port , username from prop 
> file . how this will help us?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



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


Re: Propertirs file

Posted by Vijay K Anand <r1...@freescale.com>.
Hi
i need to load LDAP server name , port , username from prop file . how 
this will help us?

Thanks replying to the mail

Wendy Smoak wrote:

>From: "Vijay K Anand" <r1...@freescale.com>
>
>  
>
>>I have a common class which gives value for keys in the properties file.
>>How do i load / read values from properties file?
>>    
>>
>
>Many of the Struts tags have attributes such as 'altKey' 'errorKey' and
>'styleKey' which will look to (usually) ApplicationResources.properties to
>retrieve a value.
>
>If you meant Properties in general...
>http://java.sun.com/docs/books/tutorial/essential/attributes/properties.html
>
>  
>
i need to load LDAP server name , port , username from prop file . how 
this will help us?


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


Re: Propertirs file

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Vijay K Anand" <r1...@freescale.com>

> I have a common class which gives value for keys in the properties file.
> How do i load / read values from properties file?

Many of the Struts tags have attributes such as 'altKey' 'errorKey' and
'styleKey' which will look to (usually) ApplicationResources.properties to
retrieve a value.

If you meant Properties in general...
http://java.sun.com/docs/books/tutorial/essential/attributes/properties.html

-- 
Wendy Smoak




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