Skip to main content

Featured

Game Development Tutorials In Android

Game Development Tutorials In Android Hi Guys,                 We are shortly started Game Development Tutorials in Android Studio. So everyone supports me and share this blogs to your friends. Guys, At this time everyone is freely available to source code and we are provide a video for step by step game developments. you are learn free and feel free to support us. Guys, if you have any question to me, so feel free to comment us. I will try to answer all the question as long as possible.                                                     Thank's                                                                          ...

Example of ServletConfig to get initialization parameter

Question : Example of ServletConfig to get initialization parameter
Ans : we are getting the one initialization parameter from the web.xml file and printing this information in the servlet.



DeServlet.java
1.     import java.io.*;  
2.     import javax.servlet.*;  
3.     import javax.servlet.http.*;  
4.       
5.     public class DeServlet extends HttpServlet {  
public void doGet(HttpServletRequest request, HttpServletResponse response)  
    throws ServletException, IOException {  
  
    response.setContentType("text/html");  
    PrintWriter out = response.getWriter();  
      
    ServletConfig config=getServletConfig();  
    String driver=config.getInitParameter("driver");  
    out.print("Driver is: "+driver);  
          
    out.close();  
    }  
6.       
7.     }  

web.xml
1.     <web-app>  
2.       
3.     <servlet>  
4.     <servlet-name>DeServlet</servlet-name>  
5.     <servlet-class>DeServlet</servlet-class>  
6.       
7.     <init-param>  
8.     <param-name>driver</param-name>  
9.     <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>  
10.   </init-param>  
11.     
12.   </servlet>  
13.     
14.   <servlet-mapping>  
15.   <servlet-name>DeServlet</servlet-name>  
16.   <url-pattern>/servlet1</url-pattern>  
17.   </servlet-mapping>  
18.     

19.   </web-app>  


If this information is important to you , and you want to , I will continue writing some more details of programming language, so click on the advertising, available on this page. This is motivate me for writing some more blogs.

Comments