The follow is what I specified in DD <servlet> <servlet-name>Basic</servlet-name> <jsp-file>/Basic.jsp</jsp-file> <init-param> <param-name>mail</param-name> <param-value>email@example.com</param-value> </init-param> </servlet>
As Bear pointed out change your name in accordance to the Ranch's Naming Policy.
Secondly , There is something wrong which you've been doin ! First of all , its not <%= config.getAttribute("mail") %> , It should be <%=config.getInitParameter("mail")%> another thing i would like to point out just FYI. For successfully getting the parameters , You need to access the servlet and not the JSP i.e not Basic.jsp , If you access http://localhost:8080/yourwebappname/servlet/Basic , You would get the value of mail param.
You would not get correct output if you are using Basic.jsp , because the JSP engine creates two different instances of the generated servlet class , one for accessing it as a named servlet and one for accessing it as a JSP page and will pass each servlet instance a different ServletConfig object. In order to be able to use the same servlet instance and hence the same configuration when using either of the URLs mentioned, we have to explicitly map the JSP page�s URL in the deployment descriptor file using the <servlet-mapping> element like this :
Hope this helps you..
Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Can we use getServletConfig is JSP as we use in Servlet