zoukankan      html  css  js  c++  java
  • javaweb项目中绝对路径的写法理解

    Tomcat的默认访问路径为http://localhost:8080,后需添加项目路径。
    请求转发,是转发到本项目中的其他文件,所以在默认访问路径中添加了本项目的项目路径,故可以省略项目名称:
    request.getRequestDispatcher ("/register.jsp");
    重定向可以转到非本项目的资源,项目名不可省略:
    response.sendRedirect (request.getContextPath ()+"/login.jsp");
    在jsp文件中,由于不知道将请求提交到本项目中其他文件,还是其它项目,所以需要指定项目名:
    <form action="/day17_registerdemo/login" method="post">
    用户名:<input type="text" name="username" /><br />
    密 码:<input type="password" name="password" /><br />
    <input type="submit" value="登录">
    </form>
  • 相关阅读:
    leetcode165
    leetcode63
    leetcode92
    leetcode86
    捣鼓Haskell
    递归操作链表
    treap(堆树)
    贪心策略 — 分数背包
    LeetCode.21
    LeetCode.94
  • 原文地址:https://www.cnblogs.com/gdwkong/p/8079213.html
Copyright © 2011-2022 走看看