TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Monday 27 April 2020

JSP Config Implicit Object In Java | JSP Config Implicit Object In Java In Hindi

JSP config implicit object

In JSP, config is an implicit object of type ServletConfig. This object can be used to get initialization parameter for a particular JSP page. The config object is created by the web container for each jsp page.

Generally, it is used to get initialization parameter from the web.xml file.

Example of config implicit object:

index.html


      <form action="welcome">  
      <input type="text" name="uname">  
      <input type="submit" value="go"><br/>  
      </form>  

web.xml file


       <web-app>  
  
          <servlet>  
      <servlet-name>pramoddwivedi</servlet-name>  
    <jsp-file>/welcome.jsp</jsp-file>  
  
     <init-param>  
     <param-name>dname</param-name>  
     <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>  
      </init-param>  
  
             </servlet>  
  
           <servlet-mapping>  
           <servlet-name>pramoddwivedi</servlet-name>  
        <url-pattern>/welcome</url-pattern>  
            </servlet-mapping>  
  
           </web-app>  

welcome.jsp


   <%   
    out.print("Welcome "+request.getParameter("uname"));  
  
   String driver=config.getInitParameter("dname");    
   out.print("driver name is="+driver);   
    %>  

Output

download image of jsp config object

Fig: Jsp config object


No comments:

Post a Comment