Sure,
working:
<div class="contentBubble">
<div class="contentImg">
<img src="/app/assets/ctx/1.0/layout/images/products/filename.png
<view-source:http://puck.moremagic.com:8080/mloyalty/assets/ctx/1.0/layout/images/products/topupfnf-android.png>"/>
</div>
<h2> <font color='green'> $5 - 250 MP</font></h2>
<p> $5 USD!<br /><br />
<a href="index.pagelinker/RedeemTab?t:ac=5
<view-source:http://puck.moremagic.com:8080/mloyalty/cai/index.pagelinker/RedeemTab?t:ac=5>">
Redeem</a></p>
</div>
not-working:
<div class="contentBubble first">
<div class="contentImg">
<img src="/layout/images/products/filename.jpg
<view-source:http://puck.moremagic.com:8080/layout/images/products/indiaAircel.jpg>"/>
</div>
<h2> <font color='red'>$6 - 300 MP</font></h2>
<p> $6 USD!<br /><br />
<strong class="earn">Earn more MP to buy this product!</strong></p>
</div>
I certainly agree the src attribute doesn't come out right between the
two. What your asking for here is probably the best demonstration of
what I've been trying to get at so far.
I can go even further and say that these same src attributes are already
set to those strings in the component. That debug code I have that reads
the imgRef is the same as the working and non-working src attributes
respectively.
What seems to be happening, is that when the call to <t:ContentBubble>
is made in the Page TML, the BindingConstants.CONTEXT parameter is not
able to resolve "/layout/images/products/${prod.imageLink}" properly
into the context path, while it can resolve
"/layout/images/products/filename.png". I'm not completely understanding
why, buy all evidence suggests as much to me.
-Rich
On 12/15/2010 05:06 PM, Josh Canfield wrote:
Can you provide the HTML that is rendered for the image tag using
under the working and non-working scenarios? The only thing that makes
sense to me is that you are not generating the same src attribute
using the two methods.
On Wed, Dec 15, 2010 at 1:57 PM, Rich M<rich...@moremagic.com> wrote:
On 12/15/2010 03:29 PM, Thiago H. de Paula Figueiredo wrote:
On Wed, 15 Dec 2010 18:25:44 -0200, Rich M<rich...@moremagic.com> wrote:
That doesn't quite solve it though, how do I get it to know
"yourpicture.jpg"? That's a dynamic String within the system that changes
throughout the loop. The images themselves are static, but the filename
string is not.
<img src="/yourimagesfolder/${picture}"/>
public String getPicture() {
....
}
Right, that was what I started out trying by several means before, as I
mentioned in previous e-mails, but I can't get it to resolve correctly.
example:
xxx.xxx.xx.xx - - [15/Dec/2010:21:43:44 +0000] "GET
/layout/images/products/filename.png HTTP/1.1" 404 1330
"http://localhost/app/customer/Overview" "Mozilla/5.0 Firefox/3.6.12"
Comes out as a 404 even though the image certainly exists.
Maybe the code will help? I included both what works and doesn't work. In
the Page TML the first<t:ContentBubble> is the one that works, using
hardcoded file name. Meanwhile the second instance does not work, even
though ${prod.imageLink} resolves to the same exact String as the hardcoded
file name.
Page TML:
<html
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
<t:loop source="products" value="prod">
${checkIfUseable(prod)}
<t:if test="useable">
<t:ContentBubble
first="${first}"
title="${startGood} ${prod.name} - ${prod.pointPrice} MP ${end}"
text="${prod.freetext}"
imgRef="/layout/images/products/topupfnf-android.png"
linkText="${message:redeem-link}"
linkRef="index.pagelinker/RedeemTab?t:ac=5"
displayLink="true"
/>
<p:else>
<t:ContentBubble
first="${first}"
title="${startBad} ${prod.name} - ${prod.pointPrice} MP ${end}"
text="${prod.freetext}"
imgRef="/layout/images/products/${prod.imageLink}"
linkText="${message:earn-points}"
linkRef="./"
/>
</p:else>
</t:if>
</t:loop>
</html>
Component Code:
public class ContentBubble {
@Inject
private Logger log;
@Property
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String title;
@Property
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String text;
@Property
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String linkRef;
@Property
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String linkText;
@Property
@Parameter(required = true, defaultPrefix = BindingConstants.CONTEXT)
private String imgRef;
@Property
@Parameter(defaultPrefix = BindingConstants.LITERAL)
private Boolean first;
@Property
@Parameter(defaultPrefix = BindingConstants.LITERAL)
private Boolean newWindow;
@Property
@Parameter(defaultPrefix = BindingConstants.LITERAL)
private Boolean displayLink;
@BeginRender
public void renderPage(MarkupWriter writer) {
log.debug("Rendering ContentBubble with: " + "\n" +
"title: " + title + "\n" +
"text: " + text + "\n" +
"linkRef: " + linkRef + "\n" +
"linkText: " + linkText + "\n" +
"imgRef: " + imgRef + "\n" +
"first: " + first + "\n" +
"newWindow: " + newWindow + "\n" +
"displayLink: " + displayLink + "\n");
if(first){
writer.writeRaw("<div class=\"contentBubble first\"> <div
class=\"contentImg\"> <img src=\""+imgRef+"\" /> </div>");
writer.writeRaw("<h2> " + title +"</h2>");
writer.writeRaw("<p> " + text +"<br /><br />");
if(displayLink != null&& displayLink){
if(newWindow != null&& newWindow)
writer.writeRaw("<a href=\""+linkRef+"\"
target=\"_blank\"> " + linkText +"</a>");
else
writer.writeRaw("<a href=\""+linkRef+"\"> " + linkText
+"</a>");
}else{
writer.writeRaw("<strong
class=\"earn\">"+linkText+"</strong>");
}
writer.writeRaw("</p></div>");
}else{
writer.writeRaw("<div class=\"contentBubble \"> <div
class=\"contentImg\"> <img src=\""+imgRef+"\" /> </div>");
writer.writeRaw("<h2> " + title +"</h2>");
writer.writeRaw("<p> " + text +"<br /><br />");
if(displayLink != null&& displayLink){
if(newWindow != null&& newWindow)
writer.writeRaw("<a href=\""+linkRef+"\"
target=\"_blank\"> " + linkText +"</a>");
else
writer.writeRaw("<a href=\""+linkRef+"\"> " + linkText
+"</a>");
}else{
writer.writeRaw("<strong
class=\"earn\">"+linkText+"</strong>");
}
writer.writeRaw("</p></div>");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org