• jQuery
  • Spring
  • JavaScript
  • Core Java
  • Servlet
  • SQL Tutorial
  • Struts
  • RubyonRails
  • PHP

  • <

    JSP config

    JSP config implicit object is used to get the configuration information from jsp page. Config object is used to fetch information parameter.


    Jsp config functions


  • String getInitParameter(String paramname)
  • Enumeration getInitParameterNames()
  • ServletContext getServletContext()
  • String getServletName()
  • Jsp implicit object Config Example


    index.html
    <form action="get.jsp">   
    <input type="text" name="name">  
    <input type="submit" value="submit"><br/>  
    </form>  
    


    web.xml
    <web-app>  
      
    <servlet>  
    <servlet-name>java</servlet-name>  
    <jsp-file>/index.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>java</servlet-name>  
    <url-pattern>/welcome</url-pattern>  
    </servlet-mapping>  
      
    </web-app>  
    
    


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
















    © copyright 2017-2021 Completedone pvt ltd.