0

This is my first post on stack, and I wish to particularly thank the founders of this great site.

My question will seem to be a duplicte of what already exist. However, I wish to point out that it is not. For several weeks now I have done a number of search over the web and found this response which I thaught could help. But after trying, I got no solution.

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

Here is my problem:

  1. I am using tomcat 8 and my images are stored in C:\Server\Tomcat\webapps\uploadimg\pa\imgstsore

  2. The name of each image is stored in a database.

  3. The below jsp code is suppose to display all my images. Unfortunately only the image for my logo is display . On solution please

<%@ 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> 
Community
  • 1
  • 1
Tabs
  • 1
  • 2

1 Answers1

0

Well, It should work fine. Check out the extension of the images and that in database. Case sensitivity may be the reason for your problem. Avoid using "http://localhost:8080", it will work only on the server system. Put the "uploadimg" folder inside the root folder and simply access it using "uploadimg/pa/imgstore/${p.imgApropos}"

sKiddie
  • 13
  • 5