2016-06-08 7 views
0

Dies ist meine erste Post auf Stapel, und ich möchte insbesondere den Gründern dieser großen Website danken.unmöglich zu zeigen Alle Bilder von Tomcat 8 Webapps

Meine Frage scheint ein Duplikat dessen zu sein, was bereits existiert. Ich möchte jedoch darauf hinweisen, dass dies nicht der Fall ist. Seit einigen Wochen habe ich eine Reihe von Recherchen über das Internet durchgeführt und fand diese Antwort, die mir helfen könnte. Aber nachdem ich es versucht hatte, bekam ich keine Lösung.

Simplest way to serve static data from outside the application server in a Java web application

Hier ist mein Problem:

  1. Ich bin mit Kater 8 und meine Bilder sind in C: \ Server \ Tomcat \ webapps \ uploadimg \ pa \ imgstsore

  2. Der Name jedes Bildes wird in einer Datenbank gespeichert.

  3. Der folgende Jsp-Code soll alle meine Bilder anzeigen. Leider wird nur das Bild für mein Logo angezeigt. On-Lösung bitte

<% @ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>

 <!--Logo --> 
     <c:if test="${p.imgLargeur == 220}"> 
     <table> 
      <tr>     
       <td><img width="220" height="200" **src="http://localhost:8080/uploadimg/pa/imgstore/${p.imgApropos}">**      </td>     
       <td style="font-size: 14pt;text-align: center;width:710px" >Logo ${p.apropos}</td>     
      </tr> 
     </table><br> 
     </c:if> 

     <!--image with text by the side --> 
     <c:if test="${p.imgLargeur == 200}"> 
     <table> 
      <tr>        
       <td colspan="2" style="font-size: 16pt;font-weight: bold;color: darkblue">${p.titre}</td> 
      </tr> 
      <tr style="height: 10px"></tr> 
      <tr> 
       <td> 
        <td><img width="220" height="200" **src="http://localhost:8080/uploadimg/pa/imgstore/${p.imgApropos}">**      </td>     
       </td> 
       <td style="font-size: 14pt;text-align: justify;width:710px">${p.apropos}</td>     
      </tr> 
     </table><br> 
      </c:if> 


     <!--image with text under --> 
     <c:if test="${p.imgLargeur == 600}"> 
     <table> 
      <tr>        
       <td colspan="2" style="font-size: 16pt;font-weight: bold;color: darkblue">${p.titre}</td> 
      </tr> 
      <tr style="height: 10px"></tr> 
      <tr> 
       <td>        
        <td><img width="600" height="400" **src="http://localhost:8080/uploadimg/pa/imgstore/${p.imgApropos}">**      </td>     
       </td>       
      </tr> 
      <tr> 
       <td style="font-size: 14pt;text-align: justify;width:710px">${p.apropos}</td> 

      </tr> 
     </table><br> 
     </c:if> 

     <!--Text without image -->  
     <c:if test="${p.imgLargeur == 0}"> 
     <table> 
      <tr>        
       <td colspan="2" style="font-size: 14pt;font-weight: bold;color: darkblue">${p.titre}</td> 
      </tr> 
      <tr style="height: 10px"></tr> 
      <tr> 
       <td style="font-size: 14pt;text-align: justify;width:710px">${p.apropos}</td>      
      </tr> 
     </table><br> 
     </c:if> 
    </c:forEach> 

Antwort

0

Well Es sollte gut funktionieren. Überprüfen Sie die Erweiterung der Bilder und die in der Datenbank. Groß-/Kleinschreibung kann der Grund für Ihr Problem sein. Vermeiden Sie die Verwendung von "http://localhost:8080", es funktioniert nur auf dem Serversystem. Setzen Sie den Ordner "uploadimg" in den Stammordner und greifen Sie einfach mit "uploadimg/pa/imgstore/$ {p.imgApropos}"

darauf zu
Verwandte Themen