| Author |
getting initialisation parameters in JSP
|
archana vishwanath
Ranch Hand
Joined: Mar 09, 2004
Posts: 39
|
|
Hi! <init-param> <param-name> uploadDir </param-name> <param-value> D:\tomcat\webapps\b2b2\images </param-value> String dirName = config.getInitParameter("uploadDir"); This way I can get my initialization parameters from a web.xml file in servlet. But this is not working for JSP.Why?OR How can I get values from web.xml file in JSP?
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
You can get the init parameters using jsp through following code: Declare the following tags in web.xml against your jsp <servlet> <servlet-name>myjsp</servlet-name> <jsp-file>/myjsp.jsp</jsp-file> <init-param> <param-name>hello</param-name> <param-value>test</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>myjsp</servlet-name> <url-pattern>/myjsp</url-pattern> </servlet-mapping> this is how you can get the init paramters.
|
 |
archana vishwanath
Ranch Hand
Joined: Mar 09, 2004
Posts: 39
|
|
Thanks Ali Gohar!It works fine
|
 |
 |
|
|
subject: getting initialisation parameters in JSP
|
|
|