Ammar:

Put all your init parameters in your web.xml as below:

<init-param>
    <param-name>secureUri</param-name>
    <param-value>https://mycompany.com/whatever</param-value>
</init-param>

Write a ContextProperties.java as below:
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ContextProperties extends Properties{

    public ContextProperties(ServletConfig config){
        Enumeration props = config.getInitParameterNames();
        if (props.hasMoreElements()){
            while (props.hasMoreElements()){
                String name = (String)props.nextElement();
                String value = (String) config.getInitParameter(name);
                put(name, value);
            }
        } else System.out.println("Props has NO elements!!!");

    }//end Constructor
} //end class ContextProperties

In your servlet's init() write code as below:
public void init(ServletConfig config) throws ServletException {
        super.init(config);
        try {
            ContextProperties props = new ContextProperties(config);
            secureUri = props.getProperty("secureUri");
            // get all other ini param values here....
        }
        catch (Exception e){
            //
            e.printStackTrace();
        }
    }//end init()

your servlet can now access "secureUri" in the normal fashion, as in
resp.sendRedirect(secureUri)
etc. You can set session vars if needed..

If this is not clear, you may want to do some reading about initialization params. The
archives have a lot of info (as usual!). In particular, look at Craig McClanahan's 
note:
http://archives.java.sun.com/cgi-bin/wa?A2=ind9906&L=servlet-interest&D=0&P=67789

Good luck!
Geeta

"Siddiqui A. Ammar" wrote:

> Hi Geeta,
> Can you explain as how can I achieve this.
> I will be greatly obliged
> Thanks
> Ammar
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to