Thanks Thiago - thanks for the pointers and the clues. I now seem to be on the right track...

Regards

Alan Chaney

Thiago H. de Paula Figueiredo wrote:
Em Tue, 29 Sep 2009 13:46:29 -0300, Alan Chaney <a...@compulsivecreative.com> escreveu:

I'm a complete newbie to T5. I need to develop my own component to go into a page. Could someone please direct me to an example on the web.

The component is very simple - it will just inject HTML from an external
source.

Writing components in T5 is very simple. A good source of examples is http://jumpstart.doublenegative.com.au:8080/jumpstart/.

In your case, you need to pull HTML from an external source. For this, I recommend Apache HttpClient. Once you have the needed HTML in a String, you'll need to write it to the output. This is done using a MarkupWriter. This is a component I use in my projects. Look at it to see how you can use a MarkupWriter. You'll need to use MarkupWriter.writeRaw() instead of write(), as the latter encodes the strings (< into &lt;, etc).

public class Message {

    /**
     * Message to be shown.
     */
    @Parameter(required = true)
    private String message;
    @BeforeRenderTemplate
    public boolean render(MarkupWriter writer) {
if (message != null && message.trim().length() > 0) { writer.element("div", "class", "t-crud-message"); writer.element("p");
            writer.write(message);
            writer.end(); // p
writer.end(); // div } return false; }

}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to