Struts2 path

interceptors There are a total of 35 interceptors, and the bottom layer executes 20 interceptors by default

Background: / The root path of the current application

frontend: front/relative path

The effect after parsing

       Backend path: http://localhost/02-path /

       Front-end path: http://localhost/02-path/test/login[/02-path/test/login /represents http://localhost]

If the comparison is successful, the jump is successful

4 methods:

1: Default project name

2:/Get the foreground path

3: Get the project name through the el expression

4: Get the path through basePath 

 <!--前台:缺省/ 是相对路径写法 参照的是服务器的根路径  -->

  <!--前台提交路径发生变化 namespace/name  -->

   <!--  <form action="test/Login" method="post">

    用户名:<input type="text" name="username">

    密&nbsp;码:<input type="password" name="password">

    <input type="submit" value="提交">

    </form> 

    <!-- 前台/写法 :代表服务器的根路径 [http://localhost/--struts.xml](http://localhost/--struts.xml)对一下

    跳转路径:404 ?/test/Login 缺少项目名称

    现在路径:http:localhost/02-psth/test/login 
                  :http:localhost/项目名/namespace/action的name
<package name="xxx" namespace="/test" extends="struts-default">
<action name="login" class="com.lanou.entity.LoginAction">
    -->

   

   <%--   <form action="${pageContext.request.contextPath}/test/Login" method="post">

    用户名:<input type="text" name="username">

    密&nbsp;码:<input type="password" name="password">

    <input type="submit" value="提交">

    </form> --%>

   

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

      test/Login” method=”post”>

    username:

    password:

   

   

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325904170&siteId=291194637