Results 1 to 8 of 8
  1. #1
    gixerino is offline Member
    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0

    Default Dynamic display of images

    Hello,

    I when I run the web application (Java server pages and database MySql), in prewiew I have a problem with the display of the images extract from the database.
    I view al the record of the database but I dont view the images.
    I dont understand because i have this problem.

    Help me please.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    gixerino is offline Member
    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0

    Default

    Here my JSP:
    Java Code:
       <sql:query var="rsResult" dataSource="jdbc/Roberto">
    SELECT * FROM portfolio
    </sql:query>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <h1>Gestione Portfolio</h1>
            <br>
            <a href="">Inserisci un nuovo record</a>
            <br>
                <c:set var="noOfRows" value="6" />
            <sql:query var="rsGestionePortfolio" dataSource="jdbc/Roberto" sql="SELECT * FROM portfolio" startRow="${param.start}" maxRows="3">
    
    </sql:query>
    <c:choose>
    <c:when test="${rsGestionePortfolio.rowCount == 0}">
        Spiacente non ci sono pił record da visualizzare
    </c:when>
    <c:otherwise>
        Elenco dei lavori eseguiti
    <table border="1">
    <!-- column headers -->
    <tr>
    <th>Ordine</th>
    <th>Nome del dominio</th>
    <th>Indirizzo web</th>
    <th>Note</th>
    <th>didascalia</th>
    </tr>
    <!-- column data -->
    <c:forEach var="row" items="${rsGestionePortfolio.rows}">
    <tr>
    <form action="aggiornaPortfolio.jsp" method="post">
    <td><input type="text" name="ordine" value="${row.ordine}" /></td>
    <td><input type="text" name="nomeDominio" value="${row.nomeDominio}" /></td>
    <td><input type="text" name="indirizzoWeb" value="${row.indirizzoWeb}" /></td>
    <td><input type="text" name="note" value="${row.note}" /></td>
    <td>
    [COLOR="Red"]<img src="public/portfolio/${row.didascalia}" alt="'.${row.nomeDominio}.'" border="0"/>[/COLOR]</td>
    <td><input type="submit" value="Aggiorna"><input type="hidden" size="1" name="id_portfolio" value="${row.id_portfolio}" /></td>
    </form>
    <td>
    <form action="" method="post">
    <input type="submit" value="Elimina"><input type="hidden" name="id_portfolio" size="1" value="${row.id_portfolio}" />
    </form>
    </td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
            </br>
    <!--- Inizio script paginazione ---->
    <c:choose>
    <c:when test="${param.start > 0}">
     <a href="">
     Previous page</a>
     </c:when>
     <c:otherwise>
         Previous page
     </c:otherwise>
     </c:choose>
     <c:choose>
         <c:when test="${rsGestionePortfolio.limitedByMaxRows}">
             <a href="">
             Next page </a>
      </c:when>
             <c:otherwise>
                 Next page
             </c:otherwise>
     </c:choose>
    <!---- Fine script paginazione ---->
        </body>
    </html>
    I have signed the record of Photo in red.

    :)

  4. #4
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    i have a question, we can directly use ${varName} ?
    or we should use <c:out value="${varName}" />?

  5. #5
    gixerino is offline Member
    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0

    Default

    I try this solution but the result is the same:

    Java Code:
    <img src="<c:out value="public/portfolio/${row.didascalia}"/>" border="0"/>
    :confused:

  6. #6
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    then...
    is the img path correct?
    "public" folder is the subfolder of the folder store this jsp?
    Last edited by mtyoung; 01-14-2009 at 04:52 AM.

  7. #7
    gixerino is offline Member
    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0

    Default

    I have the JSP file and the path "Public" under the directory "web".
    Here the structure:

    Web
    ...|
    ..index.jsp
    ...|
    ..Public
    .......|
    ......Portfolio

    :)

  8. #8
    gixerino is offline Member
    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0

    Default

    Sorry I have a doubt.


    web.xml file to view images from the database.

    Here is my web.xml file:
    Java Code:
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
        <resource-ref>
            <description>Database per amministrazione contenuti sito Roberto</description>
            <res-ref-name>jdbc/Roberto</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
        <context-param>
            <param-name>
            javax.servlet.jsp.jstl.sql.maxRows
           </param-name>
           <param-value>
               100
           </param-value>
        </context-param>
            <context-param>
            <param-name>
            javax.servlet.jsp.jstl.sql.parseDate
           </param-name>
           <param-value>
               dd/MM/yy
           </param-value>
        </context-param>
            </web-app>

Similar Threads

  1. Replies: 8
    Last Post: 12-29-2008, 08:12 AM
  2. Dynamic Table using JSP
    By banie in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-27-2008, 04:13 AM
  3. Replies: 0
    Last Post: 06-28-2008, 10:26 PM
  4. Replies: 0
    Last Post: 03-25-2008, 01:45 AM
  5. Dynamic DecimalFormatter
    By felixtfelix in forum New To Java
    Replies: 0
    Last Post: 03-17-2008, 05:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •