zoukankan      html  css  js  c++  java
  • 01_4_Struts路径问题

    01_4_Struts路径问题

    1. Struts路径问题说明

    struts2中的路径问题是根据action的路径而不是jsp路径来确定,所有尽量不要使用相对路径。

    虽然可以使用redirect方式解决,但redirect方式并非必要。

    解决办法非常简单,统一使用绝对路径。(在jsp中用request.getContextRoot方式拿到webapp的路径)或者使用myeclipse经常用的,指定basePath

    2. jsp配置绝对路径

    <%

    String path = request.getContextPath();

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

    %>

    <head>

     <base href="<%=basePath%>">

    </head>

  • 相关阅读:
    poj3686 Windys
    poj3155 Hard Life
    luoguP2774 方格取数问题
    poj3469 Dual Core CPU
    poj3281 Dining
    luogu P3410 拍照
    离散化
    最短路(SPFA)
    lower_bound && upper_bound
    gcd
  • 原文地址:https://www.cnblogs.com/flyback/p/8644818.html
Copyright © 2011-2022 走看看