Rohit Bajaj
asked on
using image url in jsp through velocity
Hi,
I have a jsp in which i am trying to get image from a local directory through a service.
The service is :
http://local.yatra.com:8080/fresco/resources/images/city/goa.jpg
I am getting the city names from another webservice
By looping over the city names i need to fetch the image corresponding to the city.
Here is my jsp :
--------------------
#foreach($requestMap in $requestMap.moduleData)
#foreach($i in $requestMap.root)
<div class="singleOffer">
<a href="$i.searchURL" class="offerHead">
<b href="$i.searchURL" class="txtMedium block">$i.cityName</b>
<!--<span class="block">Cosy Beach village</span>-->
</a>
<a href="$i.searchURL" style="width:142px;height: 102px; display: block;overflow: hidden;"><img src="http://local.yatra.com:8080/fresco/resources/images/city/${i.cityName}.jpg"/></ a>
<a href="$i.searchURL" class="pattern1">
<p class="flL mr5">Starting from</p>
<span class="txtYellow latoBold"><span class="RupeeSign">Rs.</spa n>
%{cms.handler.currencyForm atter:$i.s tartingPri ce}%
</span>
<!--<p>3 nights/person</p>-->
</a>
</div>
#end
#end
-------------------------- --
The problem i am facing is in the line :
<img src="http://local.yatra.com:8080/fresco/resources/images/city/${i.cityName}.jpg
I have tried all kinds of combination like using '' single quotes on i.cityname or appending it as a string to the src url.
But the always unable to retrieve the image. If i check the ctrl+u source page
I see sometimes the cityname remains constant or "+" sign gets appended in the url
due to which it is unable to get the image.
Please help!
Thanks
Robin
I have a jsp in which i am trying to get image from a local directory through a service.
The service is :
http://local.yatra.com:8080/fresco/resources/images/city/goa.jpg
I am getting the city names from another webservice
By looping over the city names i need to fetch the image corresponding to the city.
Here is my jsp :
--------------------
#foreach($requestMap in $requestMap.moduleData)
#foreach($i in $requestMap.root)
<div class="singleOffer">
<a href="$i.searchURL" class="offerHead">
<b href="$i.searchURL" class="txtMedium block">$i.cityName</b>
<!--<span class="block">Cosy Beach village</span>-->
</a>
<a href="$i.searchURL" style="width:142px;height:
<a href="$i.searchURL" class="pattern1">
<p class="flL mr5">Starting from</p>
<span class="txtYellow latoBold"><span class="RupeeSign">Rs.</spa
%{cms.handler.currencyForm
</span>
<!--<p>3 nights/person</p>-->
</a>
</div>
#end
#end
--------------------------
The problem i am facing is in the line :
<img src="http://local.yatra.com:8080/fresco/resources/images/city/${i.cityName}.jpg
I have tried all kinds of combination like using '' single quotes on i.cityname or appending it as a string to the src url.
But the always unable to retrieve the image. If i check the ctrl+u source page
I see sometimes the cityname remains constant or "+" sign gets appended in the url
due to which it is unable to get the image.
Please help!
Thanks
Robin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.