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:[EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]>
> >
> >
> >
> >>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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]