[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1228
  • Last Modified:

How to assign an image url dynamically?

Im trying to present a group of products on a order page and to this end i also need to display a small image of each product. The data is presented on the page using Netui:callcontrol to retrieve the data from the database control. The images are saved on the webserver and i was planning to merely link to them.

Now i was thinking i could retrieve the image url like all the other data by referring to the element in the itemcontainer. for example...

<netui:image src="{container.item.img}"/>

However this is not possible..

Is there anyone with an idea of how to achieve this? or perhaps another solution to this problem?

0
Zamiel
Asked:
Zamiel
  • 5
  • 4
1 Solution
 
ECollinCommented:
Hi,

Why do you say that it's not possible tu use something like this : <netui:image src="{container.item.img}"/>
?

Emmanuek
0
 
ZamielAuthor Commented:
because it won't assign the value of the container item to the image source. The result of trying to use " <netui:image src="{container.item.img}"/>" is an image that is not availiable. The url for the image in the browser is as follows...

http://localhost:7001/resources/images/{container.item.link}

so it is not possible to assign values to an image dynamically.
0
 
ZamielAuthor Commented:
ups.. should have been http://localhost:7001/resources/images/{container.item.img}
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ECollinCommented:
weblo 8.1, 9, 10 ?


Emmanuel
0
 
ZamielAuthor Commented:
weblogic 8.1
0
 
ECollinCommented:
plz provide the entire jsp code

Emmanuek
0
 
ZamielAuthor Commented:
here you go..

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
<%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
<%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%>
<netui-data:declareControl controlId="database" type="resources.database.database"></netui-data:declareControl>
<netui:html>
    <head>
        <title> Web Application Page </title>
    </head>
    <body>
   
    <table class="tablebody" border="1">
        <netui-data:callControl resultId="product_SelectAllResult" controlId="database" method="product_SelectAll"></netui-data:callControl>
        <netui-data:repeater dataSource="{pageContext.product_SelectAllResult}">
            <netui-data:repeaterHeader>
               
                </netui-data:repeaterHeader>
                        <netui-data:repeaterItem>
                    <tr>
                            <netui:form action="show_products_update">
                                  <td>
                                        <img src="../../resources/images/{container.item.img}" border="0">
                                  </td>
                                  <td>
                                        Code:<netui:label value="{container.item.product_code}" defaultValue="&nbsp;"></netui:label></td>
                                  <td>
                                        Name:
                                        <netui:anchor formSubmit="true" >
                                            <netui:label value="{container.item.product_name}" defaultValue="&nbsp;"/>
                                        </netui:anchor>
                                  </td>
                                  <td>
                                        Price:<netui:label value="{container.item.price}" defaultValue="&nbsp;"></netui:label>
                                  </td>
                                  <td>
                                        Max:<netui:label value="{container.item.max}" defaultValue="&nbsp;"></netui:label>
                                        <netui:hidden dataSource="{actionForm.product_id}" dataInput="{container.item.id}" />
                                  </td>
                            </netui:form>
                    </tr>
               
            </netui-data:repeaterItem>
            <netui-data:repeaterFooter></netui-data:repeaterFooter>
        </netui-data:repeater>
        </table>
    </body>
</netui:html>



0
 
ECollinCommented:
hi,

Databinding syntax works only on netui tags like <netui:image...>
the following syntax is not good :
<img src="../../resources/images/{container.item.img}" border="0">

Emmanuek
0
 
ZamielAuthor Commented:
aha i see.. so i can just use a netui:image instead :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now