• 2022-06-06
    <;servlet>;<;servlet-name>;springmvc<;/servlet-name>;<;servlet-class>;org.springframework.web.servlet.【】<;/servlet-class>;<;init-param>;<;param-name>;contextConfigLocation<;/param-name>;<;param-value>;classpath:springmvc-config.xml<;/param-value>;<;/init-param>;<;load-on-startup>;1<;/load-on-startup>;<;/servlet>;<;servlet-mapping>;<;servlet-name>;【】<;/servlet-name>;<;url-pattern>;/<;/url-pattern>;<;/servlet-mapping>;
  • DispatcherServlet#springmvc

    举一反三

    内容

    • 0

      假设在helloapp应用中有一个HelloServlet类,它在web.xml文件中的配置如下: <servlet> <servlet-name> HelloServlet </servlet-name> <servlet-class>org.javathinker.HelloServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name> HelloServlet </servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> 那么在浏览器端访问HelloServlet的URL是

    • 1

      完整地配置一个Servlet需要的标签是()。 A: <;webapp>;<;/webapp>; B: <;servlet>;<;/servlet>;和<;servlet-mapping>;<;/servlet-mapping>; C: <;servlet-name/>;和<;servlet-class>; D: <;servlet-mapping >;<; servlet-name>;

    • 2

      为Servlet上下文指定初始化参数,下面的 web. xml片段正确的是()。 A: <;context-param>;<;name >; country <;/name>;<;value >; China<;/value >;<;/ context-param>; B: <; context-param>;<;param name-"country" value-"China"/>;<;/ context-param >; C: <;context >;<; param name " country" value- "China"/>;<;/ context >; D: <;context-param >;<;param-name >; country <;/param-name>;<;param-value >; China<;/ param-value >;<;/ context-param >;

    • 3

      {阅读下面的代码: TestServlet01</servlet-name> cn.itcast.chapter04.servlet.TestServlet01</servlet-class> </servlet> TestServlet01</servlet-name> /TestServlet01</url-pattern> </servlet-mapping> TestServlet01</servlet-name> /Test01</url-pattern> </servlet-mapping> 下面选项中,可以访问chapter04应用下该Servlet的是()}

    • 4

      Given: 11.<servlet> 12.<servlet-name>catalog</servlet-name> 13.<jsp-file>/catalogTemplate.jsp</jsp-file> 14.<load-on-startup>10</load-on-startup> 15.</servlet> Which two are true?() A: Line 13 is not valid for a servlet declaration. B: Line 14 is not valid for a servlet declaration. C: One instance of the servlet will be loaded at startup. D: Ten instances of the servlet will be loaded at startup. E: The servlet will be referenced by the name catalog in mappings.