Zum Hauptinhalt gehen

How can I show an image from a JSP variable?

Kommentare

5 Kommentare

  • Zendesk API User
    Author: thmarx - 8/10/2016 7:54

    Hi Javier,

    I guess you are using dynamic database access to query firstspirit from jsp. could you please provide some code, that would help use to reproduce your problem.

    Thorsten

    0
  • Zendesk API User
    Author: javier_fernande - 8/11/2016 15:16

    Hi Thorsten,

    Yes, that's what I'm doing.

    Here is my code:

    <fsi:setSchema schema="FS_DATA">
         <fsi:search resultName="resultServices">
              <fsi:query>
                   <QUERY entityType="Services" >
                        <FILTERPARAM parameter="category" datatype="java.lang.Integer" value="<%= reqCategoryId %>"/>
                             
                        <c:if test="${-1 != reqCategoryId}">
                             <EQ attribute="ProductCategoriesList.fs_id" parameter="category" />
                        </c:if>
                   </QUERY>
              </fsi:query>
              <fsi:getQueryDetails><c:set var="totalResults" value="<%=totalResults%>"/></fsi:getQueryDetails>     

              <div>
                   <c:forEach items="${resultServices}" var="r">
                                  <c:set var="pictureServiceEntity" value="${r.visual}" />

                        <c:set var="pictureServiceString1" value="${fn:substringAfter(r.visual, '<UID>')}" />
                        <c:set var="pictureServiceString2" value="${fn:substringBefore(pictureServiceString1, '</UID>')}" />
                        <c:set var="pictureService" value="${pictureServiceString2}" />
         
                             $CMS_SET(pictureService)$<c:out value="${pictureService}" />$CMS_END_SET$                         
                             $CMS_REF(media:pictureService)$               

              
                             </c:forEach>
                   </div>
         </fsi:search>
    </fsi:setSchema>

    <fsi:setSchema schema="FS_DATA">
    <fsi:search resultName="resultServices">
    <fsi:query>
    <QUERY entityType="MarketAccessServices" >
    <FILTERPARAM parameter="category" datatype="java.lang.Integer" value="<%= reqCategoryId %>"/>
    <FILTERPARAM parameter="region" datatype="java.lang.Integer" value="<%= reqRegionId %>"/>
    <FILTERPARAM parameter="country" datatype="java.lang.Integer" value="<%= reqCountryId %>"/>
    <FILTERPARAM parameter="mandatory" datatype="java.lang.Integer" value="1"/>
    <FILTERPARAM parameter="voluntary" datatype="java.lang.Integer" value="2"/>
    <FILTERPARAM parameter="conditional" datatype="java.lang.Integer" value="3"/>
    <AND>
    <c:if test="${-1 != reqCategoryId}">
    <EQ attribute="MASProductCategoriesList.fs_id" parameter="category" />
    </c:if>
    <c:if test="${-1 != reqRegionId}">
    <EQ attribute="TUVRegionsList.fs_id" parameter="region" />
    </c:if>
    $-- 1-Mandatory 2-Voluntary 3-Conditional --$
    <OR>
    <c:if test="${-1 != reqMandatory}">
    <EQ attribute="obligation" parameter="mandatory" />
    </c:if>
    <c:if test="${-1 != reqVoluntary}">
    <EQ attribute="obligation" parameter="voluntary" />
    </c:if>
    <c:if test="${-1 != reqConditional}">
    <EQ attribute="obligation" parameter="conditional" />
    </c:if>
    </OR>
    </AND>
    </QUERY>
    </fsi:query>
    <fsi:getQueryDetails><c:set var="totalResults" value="<%=totalResults%>"/></fsi:getQueryDetails>
    <div id="mas-finder-resultset">
    <c:if test="${-1 != reqCategoryId}">
    <fsi:setSchema schema="FS_DATA">
    <fsi:search resultName="categoryName">
    <fsi:query>
    <QUERY entityType="MASProductCategories" >
    <FILTERPARAM parameter="id" datatype="java.lang.Integer" value="<%= reqCategoryId %>"/>
    <EQ attribute="fs_id" parameter="id" />
    </QUERY>
    </fsi:query>
    </fsi:search>
    </fsi:setSchema>
    <c:forEach varStatus="stat" items="${categoryName}" var="i">
    <c:set var="categoryName" value="${i.text_$CMS_VALUE(#global.language.abbreviation)$}" />
    </c:forEach>
    </c:if>
    <c:if test="${-1 != reqRegionId}">
    <fsi:setSchema schema="FS_DATA">
    <fsi:search resultName="regionName">
    <fsi:query>
    <QUERY entityType="TUVRegions" >
    <FILTERPARAM parameter="id" datatype="java.lang.Integer" value="<%= reqRegionId %>"/>
    <EQ attribute="fs_id" parameter="id" />
    </QUERY>
    </fsi:query>
    </fsi:search>
    </fsi:setSchema>
    <c:forEach varStatus="stat" items="${regionName}" var="i">
    <c:set var="countryName" value=" in ${i.text_$CMS_VALUE(#global.language.abbreviation)$}" />
    </c:forEach>
    </c:if>
    <c:choose>
      <c:when test="${(-1 != reqCategoryId || -1 != reqRegionId) && totalResults > 0}">
    <p>To sell <c:out value="${categoryName}" /><c:out value="${countryName}" />, you will need:</p>
      </c:when>
      <c:when test="${(-1 != reqCategoryId || -1 != reqRegionId) && totalResults == 0}">
    <p>No results for <c:out value="${categoryName}" /><c:out value="${countryName}" />.</p>
      </c:when>
    </c:choose>
    <div class="" style="background:white">
    <c:forEach items="${resultServices}" var="r">
    <c:set var="pictureServiceEntity" value="${r.visual}" />
    <c:set var="pictureServiceString1" value="${fn:substringAfter(r.visual, '<UID>')}" />
    <c:set var="pictureServiceString2" value="${fn:substringBefore(pictureServiceString1, '</UID>')}" />
    <c:set var="pictureService" value="${pictureServiceString2}" />
    <c:set var="textServiceString1" value="${fn:substringAfter(r.text_$CMS_VALUE(#global.language.abbreviation)$, '<DOM>')}" />
    <c:set var="textServiceString2" value="${fn:substringBefore(textServiceString1, '</DOM>')}" />
    <c:set var="textService" value="${textServiceString2}" />
    <%
    String resultEscape = StringEscapeUtils.unescapeHtml((String)pageContext.getAttribute("textService"));
    %>
    $--CMS_SET(setIdImage)$${r.fs_id}$CMS_END_SET--$
    $--CMS_VALUE(image_map[setIdImage.toString.trim])--$
    $--CMS_VALUE(image_map.toString)--$
    $--<img src="$CMS_REF(image_map[setIdImage.toString.trim])$" />--$
    $CMS_SET(pictureService)$<c:out value="${pictureService}" />$CMS_END_SET$
    $CMS_SET(titleService)$<c:out value="${r.name_$CMS_VALUE(#global.language.abbreviation)$}" />$CMS_END_SET$
    $CMS_SET(textService)$<%= resultEscape %>$CMS_END_SET$
    $CMS_RENDER(template:"mas_result",
    prm_picture:pictureService,
    prm_title:titleService,
    prm_text:textService
    )$
    </c:forEach>
    </div>
    </div>
    </fsi:search>
    </fsi:setSche

    Thank you!

    0
  • Zendesk API User
    Author: thmarx - 8/18/2016 10:04

    Hi Javier,

    sorry, but the dynamic database access module does not support medias. there is a feature request for that:  https://community.e-spirit.com/ideas/1108

    But there is a workaround: https://community.e-spirit.com/message/5498#5498

    Thorsten

    0
  • Zendesk API User
    Author: javier_fernande - 8/18/2016 13:42

    Thorsten,

    Well.. this is really a pity. Amazing that a system like this can't handle this kind of situation easily :S

    Anyway, I'll try with the workaround.

    Thanks!

    0
  • Zendesk API User
    Author: mikula - 8/23/2016 13:03

    Hello Javier,

    do you need further help or did Thorstens reply already help you? If so, it would be great if you marked the reply as "correct answer" so that other community users find the solution easily. If you have already found a solution by yourself, it would be very kind of you, if you posted it here.

    Best regards

    Martin

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.