On Mon, 29 Feb 2016 01:18:43 -0300, David Diaz <d...@viddiaz.com> wrote:
Hi all,
Hi!
I have been using Tapestry for a little bit now and I have run into one
problem that I can't figure out how to solve.
In my application I need to be able to load external code & HTML to
display to the user from a trusted source at run-time. Currently I have
gotten code to load fine and I am using outputraw to render the result
from the code.
This is pretty bad though since I have to code the HTML within the Java
file instead of having it templated.
IMHO, Tapestry templates were not built for this kind of situation
(dynamic loading of templates), even if it has some support for it. In
your case, I'd try using a general-purpose template framework like
Freemarker.
How are you doing the fetching-code-from-outside-server part? Grabbing the
.class file from outside and overwriting the corresponding class locally?
I saw that Tapestry has a "Dynamic" component that allows loading
templates> from an external source but I tried using it - it tries
loading a file from> the file system at page creation time... this is
not suitable for my use
case since I need to load it from a String and I need to do it at render
time.
I'm afraid your statement is incorrect. Dynamic's template parameter is of
type Asset, which is an interface, and you can implement it based on a
String just fine.
I also tried messing around with DynamicTemplateParser & MarkupWriter
but I couldn't get it to bind to my properties/functions since the code
is loaded at runtime and is not defined at compile time (I would hit a
NPE when the
PropBindingFactory would try and locate the component).
Full stack trace please. :)
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org