[JET] Implicit objects 'context' and 'out' [message #520333] |
Thu, 11 March 2010 23:08 |
Michael Wahler Messages: 14 Registered: July 2009 |
Junior Member |
|
|
Hi everyone,
I am currently getting started with JET and I have been able to do some
cool things so far! However, when I started to use Java declarations in
my templates, my JET skills came to an end :)
Here's what I am trying to do: I use a template in which I successfully
produce some output using tags such as <c:iterate> or <c:get>. I have
also defined some Java functions within <%! %> tags. My problem is the
interface between the template processor and the Java functions.
First, I need a reference to the top model element, which is of type
'Application', in the Java code. I have tried the statement
Application app = (Application) context.getSource();
because context is supposed to be an "implicit" (whatever that means)
object. The compiler complains that context cannot be resolved.
After I have invoked my functions, I want to print the result into the
output file. Again, I am using an implicit object:
out.write (s);
where s is of type String. However, this causes the following errors:
- Syntax error on token "s", VariableDeclaratorId expected after this token
- Syntax error on token(s), misplaced construct(s)
It seems that the "implicit" objects aren't so implicit afterall. Could
somebody please hint me to a solution?
Thanks and best regards
Michael
|
|
|
|
Powered by
FUDForum. Page generated in 0.11711 seconds