Link to home
Start Free TrialLog in
Avatar of Zamiel
Zamiel

asked on

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?

Avatar of ECollin
ECollin

Hi,

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

Emmanuek
Avatar of Zamiel

ASKER

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.
Avatar of Zamiel

ASKER

ups.. should have been http://localhost:7001/resources/images/{container.item.img}
weblo 8.1, 9, 10 ?


Emmanuel
Avatar of Zamiel

ASKER

weblogic 8.1
plz provide the entire jsp code

Emmanuek
Avatar of Zamiel

ASKER

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>



ASKER CERTIFIED SOLUTION
Avatar of ECollin
ECollin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zamiel

ASKER

aha i see.. so i can just use a netui:image instead :)