Dave Johnson on open web technologies, social software and software development
This is just a quick follow-up to my previous post on Pluggable renderers and scripting languages in Roller. It took me a while, but I finally made JRuby code work inside a Roller page template. Here's an example JRuby page template that displays most recent blog titles and text in HTML format.
Not the most beautiful thing in the world, I must admit. Any JRuby experts reading along? Is there a simple templating solution that will work in JRuby... something like Groovy Templates? And is there a way to map puts output to a java.io.Writer that will work via BSF?$out.println "<html><head>"
$out.println "<title>#{$model.weblog.name}</title>"
$out.println "</head><body>"
$out.println "<h1>#{$model.weblog.name}</h1>"
$model.weblogEntriesPager.entries.keySet().each {|day|
$model.weblogEntriesPager.entries.get(day).each {|entry|
$out.println "<h3>#{entry.title}</h3>"
$out.println "<p>#{entry.text}</p>"
}
}
$out.println "</body></html>"
Dave Johnson in Roller
05:46PM Mar 20, 2007
Comments [4]
Tags:
java
jruby
roller
Dave Johnson in Roller
07:45PM Mar 11, 2007
Comments [0]
Tags:
groovy
javascript
jruby
roller
scripting
Interested in the JRuby project? Then you should check out the JavaPosse podcast interview with JRuby developers Charles Nutter and Thomas Enebo. They cover project status, JRuby vs. CRuby, Ruby on Rails on the JVM and their new jobs at Sun.
Dave Johnson in Java
04:36AM Jan 18, 2007
Comments [0]
Tags:
jruby