commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Lea <ja...@kumachan.net.nz>
Subject Re: [Jelly] Using without a file or url (SOLVED)
Date Thu, 29 Jul 2004 08:51:09 GMT
Well, the code was already in there :)  Hidden away, and not mentioned 
in the tutorials etc

But in the java docs there is
*
*org.apache.commons.jelly.impl.Embedded

With this example:

|Embedded| provides easy means to embed JellyEngine
and use Jelly scripts within an application

A typical usage:
|
Embedded embedded = new Embedded();
embedded.setOutputStream(new ByteArrayOutputStream());
embedded.setVariable("some-var","some-object");
.....
embedded.setScript(scriptAsString);
//or one can do.
//embedded.setScript(scriptAsInputStream);

boolean bStatus=embedded.execute();
if(!bStatus) //if error
{
String errorMsg=embedded.getErrorMsg();
}|

This is exactly what I was looking for
  - takes a string or input stream
  - executes it
  - returns result as output stream

Tested it and it works.  Another satisfied customer ;)



Jason Lea wrote:

>Dion Gillard wrote:
>
>  
>
>>There was a patch for this functionality posted to the list recently.
>>
>> 
>>
>>    
>>
>Oh cool.  I'll have a hunt for it :)
>
>  
>
>>On Thu, 29 Jul 2004 17:22:29 +1200, Jason Lea <jason@kumachan.net.nz> wrote:
>> 
>>
>>    
>>
>>>I am new to Jelly.  I just started looking for something to allow me to
>>>make some templates for HTML email, and Jelly looks great.
>>>
>>>I have an idea to store some template fragments in a database, pull them
>>>out, combine them into the completed script then execute Jelly over it.
>>>However Jelly seems to only have the facilities to open files or URLs.
>>>It doesn't look like I can pass it a string containing my jelly template
>>>and execute the script.
>>>
>>>Is this the case?  or is there a way to do it?
>>>
>>>I imagine I could write my template to a temp file, execute the script
>>>on that, then delete the file - but that seems clumsy.
>>>
>>>--
>>>Jason Lea
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>>   
>>>
>>>      
>>>
>> 
>>
>>    
>>
>
>
>  
>


-- 
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message