Struts2 的路径

interceptors  总共35个拦截器,底层默认执行20个拦截器

后台:  / 当前应用的根路径

前台: 前/ 相对路径

解析完毕后的效果

       后台路径:http://localhost/02-path/

       前台路径:http://localhost/02-path/test/login[/02-path/test/login中/代表http://localhost]

如果对比成功,则跳转成功

4种方法:

1:缺省项目名

2:/获取前台路径

3:通过el表达式获取项目名称

4:通过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”>

    用户名:

    密 码:

   

   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值