jastrachan | 16 Aug 20:06 2004
Picon

Re: Jakarta BSF with Groovy language

See this page for how to initialise BSF to add Groovy support...

http://groovy.codehaus.org/Bean+Scripting+Framework

we submitted a patch to BSF a long time ago to add native support for  
Groovy - I dunno if they ever did a release with it in. Have you tried  
using the latest / greatest BSF?

On 16 Aug 2004, at 17:35, phkim@... wrote:
> Hi, developers
>
> I have tried the Jakarta BSF with Groovy language.
> My JSP source is:
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html>
> <% <at>  taglib uri="http://jakarta.apache.org/taglibs/bsf-2.0"  
> prefix="bsf" %>
> <body>
> <b>BSF with Javascript</b> <hr>
> <bsf:scriptlet language="javascript">
>   for (i = 1; i <= 9; i++) {
>     out.println (i + " is squared to " +  i*i + "<br>")
>   }
> </bsf:scriptlet>
> </table>
> <bsf:expression language="javascript"> new java.util.Date()  
> </bsf:expression>
> <hr>
>
> <b>BSF with JACL</b> <br>
> <bsf:scriptlet language="jacl">
> package require java
>
> for {set i 1} {$i<=9} {incr i 1} {
>   $out println "$i"
>   $out println [concat " is squared to " [format %d [expr $i * $i]]  
> "<br>"]
> }
> </bsf:scriptlet>
> </table>
> <bsf:expression language="jacl"> java::new java.util.Date  
> </bsf:expression>
> <hr>
>
> <b>BSF with Jython</b> <br>
> <bsf:scriptlet language="jython">
> from java.util import Date;
>
> for i in range(1,9,1):
>   out.println ("%d" % i);
>   out.println (" is squared to %d <br>" % (i*i));
> </bsf:scriptlet>
> </table>
> <bsf:expression language="jython"> Date() </bsf:expression>
> <hr>
>
> <b>BSF with Groovy</b> <br>
> <bsf:scriptlet language="groovy">
> import java.util.Date;
>
> for (i in 1..9) {
>   out.println ("${i}")
>   out.println (" is squared to ${i*i} <br>")
> }
> </bsf:scriptlet>
> </table>
> <bsf:expression language="groovy"> new Date() </bsf:expression>
>
> </body>
> </html>
>
>
> My error message is:
>
> org.apache.bsf.BSFException: unsupported language: groovy
> org.apache.bsf.BSFException: unsupported language: groovy
>         at org.apache.bsf.BSFManager.loadScriptingEngine(Unknown  
> Source)
>         at org.apache.taglibs.bsf.scriptlet.doEndTag(scriptlet.java:74)
>         at  
> org.apache.jsp.bsfTest_jsp._jspx_meth_bsf_scriptlet_3(bsfTest_jsp.java: 
> 347)
>         at org.apache.jsp.bsfTest_jsp._jspService(bsfTest_jsp.java:94)
>         at  
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>         at  
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j 
> ava:324)
>         at  
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java: 
> 292)
>         at  
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>         at  
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic 
> ationFilterChain.java:237)
>         at  
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil 
> terChain.java:157)
>         at  
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal 
> ve.java:214)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCo 
> ntextValve.java:198)
>         at  
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal 
> ve.java:152)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav 
> a:137)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav 
> a:117)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:102)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve 
> .java:109)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>
>         at  
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java: 
> 160)
>         at  
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
> 799)
>         at  
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process 
> Connection(Http11Protocol.java:705)
>         at  
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java: 
> 577)
>         at  
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPoo 
> l.java:683)
>         at  
> java.lang.Thread.run(Thread.java:534)org.apache.bsf.BSFException:  
> unsupported language: groovy
> org.apache.bsf.BSFException: unsupported language: groovy
>         at org.apache.bsf.BSFManager.loadScriptingEngine(Unknown  
> Source)
>         at  
> org.apache.taglibs.bsf.expression.doEndTag(expression.java:74)
>         at  
> org.apache.jsp.bsfTest_jsp._jspx_meth_bsf_expression_3(bsfTest_jsp.java 
> :378)
>         at org.apache.jsp.bsfTest_jsp._jspService(bsfTest_jsp.java:98)
>         at  
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>         at  
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j 
> ava:324)
>         at  
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java: 
> 292)
>         at  
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>         at  
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic 
> ationFilterChain.java:237)
>         at  
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil 
> terChain.java:157)
>         at  
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal 
> ve.java:214)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCo 
> ntextValve.java:198)
>         at  
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal 
> ve.java:152)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav 
> a:137)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav 
> a:117)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:102)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve 
> .java:109)
>         at  
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC 
> ontext.java:104)
>         at  
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>         at  
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>
>         at  
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java: 
> 160)
>         at  
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
> 799)
>         at  
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process 
> Connection(Http11Protocol.java:705)
>         at  
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java: 
> 577)
>         at  
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPoo 
> l.java:683)
>         at java.lang.Thread.run(Thread.java:534)
>
>
>
> What should I do to use Jakarta BSF with Groovy language ?
>
> Regards,
> Kim
>
>

James
-------
http://radio.weblogs.com/0112098/


Gmane