zoukankan      html  css  js  c++  java
  • Java中写路径

    说明:

      webappname:web应用的名称(tomcat目录下webapps文件夹中的项目的名称)

      doSome:url-pattern中的值

    1.超链接

    <a href="/webappname/doSome"></a>

    2.web.xml文件中的url-pattern

    <url-pattern>/doSome</url-pattern>

    3.form表单的action属性

    <form action="/webappname/doSome"></form>

    4.ServletContext对象的getRealPath方法

    String realPath = application.getRealPath(“/index.html”); 注意:必须保证webapp的根下有index.html

    5.web.xml中欢迎页面:欢迎页面比较特殊不以“/”开头,不加webapp名字,除此之外均以“/”开头

    <welcome-file-list>
        <welcome-file>html/welcome.html</welcome-file>
    </welcome-file-list>

     6.错误页面

    <error-page>  
            <error-code>404</error-code>  
            <location>/error/404.html</location>  
    </error-page> 

      

  • 相关阅读:
    CentOS
    Docker
    Chart的简单使用
    DataGridView中间插入数据行
    获取每个月的固定的第n个星期几
    设置只能开启一个程序实例
    DataContext与实体类
    Attribute
    Delegate
    Event
  • 原文地址:https://www.cnblogs.com/luna-hehe/p/14519499.html
Copyright © 2011-2022 走看看