为什么我在myecplise 的preview里效果好好的jsp页面  在经过struts2的
  <package name="struts2" extends="struts-default">
               <action name="actionLogin"  class="action.LoginAction">
                       <result name="success">admin/admin_index.jsp</result>
               </action>
       </package>
成功跳转后 图片 和 css 效果就都没了呢?

解决方案 »

  1.   

    以前遇到过,用绝对路径:http://127.0.0.1:8080/项目名/文件夹名/aa.jpg
      

  2.   

    使用绝对路径,myeclipse中提供了<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <head><base href="<%=basePath%>"></head>之后就可以使用相对路径了,系统会直接映射到你的绝对路径!
      

  3.   

    <a href="<%=basePath %>/actionLogin.action"> 登录 </a>
      

  4.   

    用这个.
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <head><base href="<%=basePath%>"></head>