我是这样做的,刚开始登陆,进入到菜单,点菜单下以个TOP的按钮,然后生成事件onclick=“login()”   function login(){
       window.top.location = "LoginAction.do?op=loginagin";
}
  走一个action(LoginAction)
       我那个action里做了这样一个事,就是把session都清理掉、销毁。request.getSession().removeAttribute("User");
request.getSession().invalidate();
return mapping.findForward("loginagin");返回loginagin,loginagin在strut-config.xml里是这样的:<forward name="loginagin" path="/index.jsp"/>然后就跳到inde.jsp页面了,但是这个页面的图片了,都不显示了。图片全有红叉。
 请高人指点。不知道为什么。
    在线等

解决方案 »

  1.   

    forward转发使原来的图片路径错误!把图片路径改成工程下的绝对路径就可以了!
      

  2.   

    原来的index在浏览器下的index
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>儘僌僀儞</title>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <!-- add by zxl-->
    <meta   http-equiv="Expires"   CONTENT="0">        
      <meta   http-equiv="Cache-Control"   CONTENT="no-cache">      
      <meta   http-equiv="Pragma"   CONTENT="no-cache">   
    <script src="script/formtools.js" type="text/javascript">
    </script>
    </head>
    <script language="JavaScript">
    function handleEnter()
    {
    if(event.keyCode == 13)
    {
    submitit();
        window.event.cancelBubble = true;
        window.event.returnValue = false;
        return false;
    }
    }function submitit()
    {
    if(!checkInput(LoginForm.strUser))
    return;
    if(!checkInput(LoginForm.strPassword))
    return;
        
        if(LoginForm.strUser.value == "")
        {
         return alert('儐乕僓ID傪擖椡偟偰偔偩偝偄丅');
        }
        if(LoginForm.strPassword.value == "")
        {
         return alert('僷僗儚乕僪傪擖椡偟偰偔偩偝偄丅');
        }

    LoginForm.submit();
    }function swapImage(imgObj)
    {
    imgObj.src = "images/loginpage/start_loop4.gif";
    }
    function restoreImage(imgObj)
    {
    imgObj.src = "images/loginpage/start_loop2.gif";
    }
    function initPage()
    {
    LoginForm.strUser.focus();
    if(navigator.userAgent.indexOf("Windows") > -1)
    {
    LoginForm.strUser.width=178;
    LoginForm.strPassword.width=178;
    LoginForm.strUser.style.height = 20;
    LoginForm.strPassword.style.height = 20;
    }
    }
    </script>
    <body bgcolor="#FFFFFF" text="#666666" leftmargin="0" topmargin="0" style="margin:0"  scroll="no" onload="initPage();">
    <form name="LoginForm" method="post" action="/smcWeb/sections/LoginAction.do?" id="LoginForm">
    <table width="561" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr> 
        <td bgcolor="#336699" background="images/loginpage/back02.gif" colspan="3"><img src="images/loginpage/spacer.gif" width="1" height="153"><img src="images/loginpage/spacer.gif" width="560" height="1"></td>
      </tr>
      <tr> 
        <td bgcolor="#CCCCCC" colspan="3"><img src="images/loginpage/spacer.gif" width="1" height="6"></td>
      </tr>
      <tr> 
        <td colspan="3"><img src="images/loginpage/spacer.gif" width="1" height="15"></td>
      </tr>
      <tr> 
        <td align="center" width="51"><img src="images/loginpage/spacer.gif" width="51" height="1"> 
        </td>
        <td align="center" width="459">
          <table width="459" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td width="74"><img src="images/loginpage/spacer.gif" width="15" height="1"><img src="images/loginpage/title01.gif" width="73" height="26"><img src="images/loginpage/dot_g.gif" width="1" height="26"></td>
              <td width="385"><img src="images/loginpage/title02_3.gif" width="283" height="27"><img src="images/loginpage/spacer.gif" width="103" height="1"></td>
            </tr>
            <tr> 
              <td colspan="2"><img src="images/loginpage/spacer.gif" width="1" height="23"></td>
            </tr>
            <tr align="center"> 
              <td colspan="2">
                
                  <table width="247" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="100" valign="bottom" align="right" nowrap><img src="images/loginpage/spacer.gif" width="25" height="8"><img src="images/loginpage/id_3.gif" width="75" height="21"><img src="images/loginpage/spacer.gif" width="3" height="1"></td>
                      <td width="178" valign="bottom"> 
         <input type="text" name="strUser" maxlength="8" size="30" tabindex="1" value="" onkeypress="cancelEnter();" alt="userid"> 
                      </td>
                      <td rowspan="3" valign="top" width="80" align="left" nowrap> 
                        <div align="center"><a href="javascript:submitit();"><img onmouseout="restoreImage(this)" onmouseover="swapImage(this)" border="0" src="images/loginpage/start_loop2.gif" width="52" height="52" hspace="3" vspace="3" align="left"></a></div>
                      </td>
                    </tr>
                    <tr> 
                      <td><img src="images/loginpage/spacer.gif" width="1" height="3"></td>
                      <td><img src="images/loginpage/spacer.gif" width="1" height="3"></td>
                    </tr>
                    <tr> 
                      <td width="100" valign="top" align="right"><img src="images/loginpage/spacer.gif" width="25" height="1"><img src="images/loginpage/pass_3.gif" width="75" height="21"><img src="images/loginpage/spacer.gif" width="3" height="1"></td>
                      <td width="178" valign="top"> 
                 <input type="password" name="strPassword" maxlength="30" size="30" tabindex="2" value="" onkeypress="handleEnter();" alt="password"> 
                      </td>
                    </tr>
                  </table>
                
    </td>
            </tr>
          </table>
        </td>
        <td align="center" width="51"><img src="images/loginpage/spacer.gif" width="51" height="1"></td>
      </tr>
      <tr> 
        <td colspan="3"><img src="images/loginpage/spacer.gif" width="1" height="10"></td>
      </tr>
      <tr> 
        <td bgcolor="#CCCCCC" colspan="3"><img src="images/loginpage/spacer.gif" width="1" height="6"></td>
      </tr>
      <tr> 
        <td bgcolor="#336699" background="images/loginpage/back04.gif" colspan="3"><img src="images/loginpage/spacer.gif" width="1" height="509"><br>
          <img src="images/loginpage/back05.gif" width="561" height="255"></td>
      </tr>
    </table>
    </form>
    </body>
    </html>路径没变啊。
      

  3.   

    <img src="/项目名/images/loginpage/spacer.gif" width="1" height="15">
      

  4.   

    不知道你的项目中有没有用过滤器 
    如果你用过滤器的话,你主要不要把图片过滤掉了。。
    比如:/*则全都过滤点了,一般用只过滤*.jsp
      

  5.   

      您的这个方法是可行的,但是抛出一个异常。    Error page exception The server cannot use the error page specified for your application because of the exception printed below.
     Error Page Exception: : com.ibm.ws.webcontainer.webapp.WebAppErrorReport: /error.jsp麻烦帮忙看看。