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