• java Servlet(续)


    一、web.xml配置

    由于需用户需要通过URL访问架设好的Servlet,所以我们必须将servlet映射到一个URL地址上,

    比如上面的配置文件我们就可以通过:http://localhost:8080/JAVAServletTest/2.jsp 这个Url来访问....一个Servlet页面可以映射多个Url地址

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
    <servlet>
    <servlet-name>ServletTest</servlet-name>
    <servlet-class>ServletTest.ServletTest</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ServletTest</servlet-name>
    <url-pattern>/2.jsp</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
    <servlet-name>ServletTest</servlet-name>
    <url-pattern>/3.jsp</url-pattern>

    <servlet-mapping>
    <servlet-name>ServletTest</servlet-name>
    <url-pattern>/4.jsp</url-pattern>
    </servlet-mapping>
    </web-app>

    二、servlet如果遇到公共操作的数库部分,如何避免数据并发时导致的数据错误

    上面的两点参考的:http://www.cnblogs.com/xdp-gacl/p/3760336.html 这个地址

  • 相关阅读:
    集合容器概述
    enum枚举类型
    this关键字、this()、super()
    重载与重写
    nginx报404的可能错误
    nginx常用命令
    vbs系统监控
    VBS windows监控
    Oracle SQL优化[转]
    shell /bin/bash^M: bad interpreter错误解决
  • 原文地址:https://www.cnblogs.com/xiaoliao/p/5087254.html
Copyright © 2020-2023  润新知