简体   繁体   English

在JSP中显示图片(网络商店)

[英]Display image in jsp (web store)

Im trying to display image in grid in compiere webstore 我正在尝试在Compiere Webstore中的网格中显示图像

JSP JSP

<div id="content">
    <h2>Login </h2>

      <form method="get" name="ClientLogin" action="clientLoginServlet" enctype="application/x-www-form-urlencoded" onSubmit="">
        <input class="bluebutton" name="Submit" type="submit" value="Submit">    
        <table class="contentTable">
        <tr> 
          <th class="left">Client ID</th>
          <th class="left">Verification</th>
          <th class="left">Sign In</th>
          <th class="left">Sign out</th>        
          <th class="left">Signature</th>      
           <th class="left">Signature</th>   
        </tr>   
        <c:forEach items='${info.webstore}' var='web' varStatus='status'>
            <jsp:useBean id="status" type="javax.servlet.jsp.jstl.core.LoopTagStatus" />
            <c:choose>
                <c:when test="<%= status.getCount() %2 == 0 %>">
                    <c:set var="rowClass" value="evenRow"/>
                </c:when>
                <c:otherwise>
                    <c:set var="rowClass" value="oddRow"/>
                </c:otherwise>
            </c:choose>  
        <tr> 
          <td class="<c:out value='${rowClass}' /> left"><c:out value='${web.name}'/></td>
          <td class="<c:out value='${rowClass}' /> left"><c:out value='${web.verification}'/></td>        
          <td class="<c:out value='${rowClass}' /> left"><fmt:formatDate value='${web.date_Signin}' type="both" /></td>
          <td class="<c:out value='${rowClass}' /> left"><fmt:formatDate value='${web.date_Signout}' type="both"/></td>                   
          <td class="<c:out value='${rowClass}' />">                        
                 <img src="<c:out value='${web.imageURL}'/>" alt="image" height="142" width="142"> </td>
           </td>

          <td class="<c:out value='${rowClass}' /> left">      
                <a href="clientloginservlet?ST_WebStore_ID=<c:out value='${web.ST_WebStore_ID}'/>&AttachmentIndex=<c:out value='1'/>" target="_blank">
                    <c:out value='${web.fileName}'/> </a         
          </td>                     
        </tr>  
         </c:forEach>     
      </table>  

       </form>    
      </div>

Im getting this image url from attachment 我从附件获取此图像网址

JAVA JAVA

MAttachment attachment = MAttachment.get(ctx, this.get_Table_ID(), record_id);
        if(attachment!=null)
        {
        MAttachmentEntry ent = attachment.getEntry(0);  
            if(ent!=null)
            {
            File f = ent.getFile();
            String filename = f.getName();      
            String path = f.getAbsolutePath();
            setFileName(filename);
            setImageURL(path);
            }
        }

My image path should be like this but image doesn't display <img src="D:\\Compiere\\jboss-as-7.1.1.Final\\bin\\ui.png" alt="image" height="142" width="142"> 我的图像路径应该是这样,但是图像不会显示<img src="D:\\Compiere\\jboss-as-7.1.1.Final\\bin\\ui.png" alt="image" height="142" width="142">

And <a href="clientloginservlet?record_ID=<c:out value='${web.record_ID}'/>&AttachmentIndex=<c:out value='1'/>" target="_blank"><c:out value='${web.fileName}'/> </a > In anchor tag i can't get into my servlet class 并且<a href="clientloginservlet?record_ID=<c:out value='${web.record_ID}'/>&AttachmentIndex=<c:out value='1'/>" target="_blank"><c:out value='${web.fileName}'/> </a >在锚标记中,我无法进入我的servlet类

Please anyone help me to resolve this 请任何人帮我解决这个问题

Try image path like this 试试这样的图像路径

file:///D:/Compiere/jboss-as-7.1.1.Final/bin/ui.png

So 所以

<img src="file:///D:/Compiere/jboss-as-7.1.1.Final/bin/ui.png" alt="image" height="142" width="142">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM