Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How do you pass an init parameter to a JSP?
You can pass the init parameters into your JSP file by decaring them into your deployment descriptor web.xml file.

<servlet>  
   <servlet-name>My Page</servlet-name>
   <jsp-file>/mypage.jsp</jsp-file>  
   <init-param>  
      <param-name>email</param-name>  
      <param-value>jalees786@gmail.com</param-value) </init-param>
</servlet>

<servlet-mapping> 
   <servlet-name>My Page</servlet-name>
   <url-pattern>/foo</url-pattern> 
</servlet-mapping> 

You can access init parameters into your JSP file using the following code :

<% 
String email = getServletConfig().getInitParameter("email");
%>
Posted By: Name:Rajesh Kr URL: How do you pass an init parameter to a JSP?