我在myeclipse8.5中可以正常显示图片也可以上传,但是放到tomcat中就不能显示图片,上传也不能!有说是<imagePath>的问题。但是我删掉了还是不行,是怎么回事呢!谢谢大家了!

解决方案 »

  1.   

    具体问题log贴上来看看呗good luck
      

  2.   

    <%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
       
        
        <title>My JSP 'news.jsp' starting page</title>
        
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  </head>
      
      <body>
         <% int id=Integer.parseInt(request.getParameter("id").toString());
            String title=request.getAttribute("title").toString();
            String content=request.getAttribute("content").toString();
            String imagePath=request.getAttribute("imagePath").toString();
            String date=request.getAttribute("date").toString();
         %>
           <table width="900" height="235" border="0" align="center" bordercolor="#333333" bgcolor="#FFCCCC">
             <tr>
               <th align="center">
               <p><font color="#FF0000" style="font-size: 19pt"><%=title %></font> </p></th>
             </tr>
             <tr>
               <td><div align="right">
                 <h5><a href="shouye.jsp">首页</a>&nbsp;&nbsp;&nbsp;【发布时间:<%=date %>】</h5>
               </div></td>
             </tr>
              <tr>
               <td><div align="center"><img height="200px" width="220px" border="" src="<%= imagePath%>" /></div></td>
             </tr>
             <tr>
             
               <td>&nbsp;&nbsp;&nbsp;&nbsp;<%=content %>          </td>
             </tr>
            
             <tr>
               <td><div align="center"> 
                 <%if(id==1){out.print("上一条");}else{ %>
                 <a href="imageNewsCheck.jsp?id=<%=String.valueOf(id-1)%>">上一条</a><%} %> 
                 <%for(int i=1;i<=5;i++){
                      if(i==id){
                         out.print(id);
                      }else{
                      %>
                      <a href="imageNewsCheck.jsp?id=<%=i%>"><%=i%></a>
                      <% 
                      }
                   } 
                 %>
                 <%if(id==5){out.print("下一条");}else{ %>
                 <a href="imageNewsCheck.jsp?id=<%=String.valueOf(id+1)%>">下一条</a>
                 <%}%></div></td>
             </tr>
      </table>
      </body>
    </html>
    这是显示图片的代码,在tomcat中就是显示不出来!
      

  3.   

    路径没有问题,是绝对路径。而且他在myeclipse中可以正常显示!
    有人说是<basepath >问题,我已经删除了为什么还不好使呢!
      

  4.   

    那个图片的地址是从数据库里读出开的啊,路径没有问题啊!他如果有问题在myeclipse中也不会显示的啊!
      

  5.   

    myeclipse里自带的浏览器和IE是有区别的!
    你在IE地址栏中看是什么效果,不要说路径不可能有问题!
    你试都没试。你在IE地址栏中输入输入地址后,
    如果还是显示不了,那就是路径问题!