logo       

Re: TemplateServlet does not work with groovy-1.0-beta-7: msg#00148

lang.groovy.user

Subject: Re: TemplateServlet does not work with groovy-1.0-beta-7

Hi, Guillaume

I have setup in my "web.xml" for using SimpleTemplateEngine as follows:

........................................
........................................
<servlet>
<servlet-name>STemplate</servlet-name>
<servlet-class>groovy.servlet.TemplateServlet</servlet-class>
<init-param>
<param-name>bindDefaultVariables</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>bindRequestParameters</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>templateEngine</param-name>
<param-value>groovy.text.SimpleTemplateEngine</param-value>
</init-param>
</servlet>
........................................
........................................
<servlet-mapping>
<servlet-name>STemplate</servlet-name>
<url-pattern>*.stemplate</url-pattern>
</servlet-mapping>
........................................
........................................


Here are two examples that I have tested.


######################
# test1.stemplate
<%= request %>

[Test URL]
http://localhost:8080/Groovy/test1.stemplate?name=guest
[Result]
org.apache.coyote.tomcat5.CoyoteRequestFacade@1d532ae


######################
# test2.stemplate
<%= request.queryString %>


[Test URL]
http://localhost:8080/Groovy/test2.stemplate?name=guest
[Result]
java.lang.NoClassDefFoundError: org/apache/coyote/tomcat5/CoyoteRequestFacade

gjdk.org.apache.coyote.tomcat5.CoyoteRequestFacade_GroovyReflector.invoke(CoyoteRequestFacade_GroovyReflector.java)
groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:63)
groovy.lang.MetaClass.getProperty(MetaClass.java:612)
org.codehaus.groovy.runtime.Invoker.getProperty(Invoker.java:585)

org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169)
Script1.run(Script1.groovy:1)
groovy.text.SimpleTemplateEngine$1.writeTo(SimpleTemplateEngine.java:93)
groovy.servlet.TemplateServlet.merge(TemplateServlet.java:510)
groovy.servlet.TemplateServlet.doRequest(TemplateServlet.java:249)
groovy.servlet.TemplateServlet.doGet(TemplateServlet.java:201)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


######################
# test3.stemplate
<%= name %>

[Test URL]
http://localhost:8080/Groovy/test3.stemplate
[Result]
HTTP Status 500 - No such property: name for class: Script1



For the second example "test2.stemplate", it seems that
the class CoyoteRequestFacade can not be accessed by TemplateServlet.

For the third example "test3.stemplate", I remember that
there was printed "null" on Groovy 1.0 Beta 6 when the parameter "name" does
not exist
in the request.


Regards,
Kim


On Mon, Oct 25, 2004 at 09:51:35AM +0200, Laforge Guillaume wrote:
> Again, what exactly doesn't work? Could you be more precise, please?
>
> Guillaume
>
> -----Message d'origine-----
> De : phkim-Yd8/yUic+sk+MW+wcPHoAA@xxxxxxxxxxxxxxxx
> [mailto:phkim-Yd8/yUic+sk+MW+wcPHoAA@xxxxxxxxxxxxxxxx]
> Envoy? : dimanche 24 octobre 2004 09:13
> ? : user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
> Objet : [groovy-user] TemplateServlet does not work with
> groovy-1.0-beta-7
>
>
> HI,
>
> It seems for my case that TemplateServlet does not work.
> On both groovy 1.0 beta 7 and beta 8 SNAPSHOT (from groovy-core CVS).
>
> So I have changed the source groovy/servlet/TemplateServlet.java.
>
>
> Regards,
> Kim
>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise