Li Wu:
Learn to think more, honouring teachers save Thanksgiving. Leaf See Root 321, rivers with one.
Meekness Conscience Lord, willing to do without regrets to the most bitter. Reading exercise strong body and mind, Prudential advised and the line and cherish.
Javaee:7
javase:1.8
jstl:1.2.2
Server:tomcat 8.5
Explorer:firefox
Os:windows7 x64
Ide:myeclipse
Project directory Structure
Xml
<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee/http Xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "id=" webapp_id "version=" 3.1 "><servlet><servlet-name> Readinitdataservletcontext</servlet-name><servlet-class> Jizuiku.web.servlet.readinitdataservletcontext</servlet-class></servlet><servlet-mapping> <servlet-name>readinitdataservletcontext</servlet-name><url-pattern>/ Readinitdataservletcontext</url-pattern></servlet-mapping><context-param><param-name> Minnum</param-name><param-value>10</param-value></context-param><context-param> <param-name>count</param-name><param-value>100</param-value></context-param>< context-param><param-name>maxnum</param-name><param-value>1000</param-value></context-param></web-app>
Code
Package Jizuiku.web.servlet;import Java.io.ioexception;import Java.util.enumeration;import Javax.servlet.servletcontext;import Javax.servlet.servletexception;import Javax.servlet.http.httpservlet;import Javax.servlet.http.httpservletrequest;import javax.servlet.http.httpservletresponse;/** * Read the names and values of all global initialization variables * * @ Author to the bitter * @version V17.10.21 */public class Readinitdataservletcontext extends HttpServlet {/** * */private static fin Al long serialversionuid = 1L; @Overrideprotected void Doget (HttpServletRequest req, HttpServletResponse resp) throws Serv Letexception, IOException {//TODO auto-generated method Stubservletcontext application = This.getservletcontext (); Enumeration<string> e = Application.getinitparameternames (); String name = Null;while (E.hasmoreelements ()) {name = E.nextelement (); SYSTEM.OUT.PRINTLN (name + ":" + application.getinitparameter (name));}} @Overrideprotected void DoPost (HttpServletRequest req, HttpServletResponse resp) throws Servletexception, Ioexception {//TODO auto-generated method stub}}
Effect
Learning resources: Itcast and Itheima Video library. If you have public resources, can share to me, with your resources to learn also can.
Blog post is to watch the video, into thinking written. It's good that the teacher speaks well. Blog bad, is to give the most bitter not serious.
Javaweb base ServletContext getinitparameternames Read Global initial variable