velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Integrating VelocityViewServlet with Guice
Date Tue, 05 Apr 2011 20:38:53 GMT
Assuming the VVS is actually processing your template (which isn't
totally certain from what you've reported), there are only really two
other likelihoods:

- either the VVS is processing the templates with a different
servletContext/session/request than your other servlet is seeing
- or the VVS is process the template before your other servlet
populates those objects with your desired attributes

can you rule out or confirm one of those?

On Tue, Apr 5, 2011 at 12:02 PM, Garey Mills
<gmills@library.berkeley.edu> wrote:
> Hi -
>
>    I am trying to integrate VelocityViewServlet and Guice 3.0. I am having a
> problem because VelocityViewServlet does
> not seem to see what I am putting into the context to forward to it.
>
>
>    Guice intercepts all access points. You write a 'ServletModule' that
> forwards different URL patterns to different servlets.
>
>     Guice requires servlets to annotated as Singletons, or to be bound to
> singleton scope in the 'ServletModule'. Here is my
> servlet module
>
> ...
>
>    protected void configureServlets() {
>
>    bind(VelocityViewServlet.class).in(Singleton.class);
>
>    serve("*.vm").with(VelocityViewServlet.class);
>
>    serve("/gisform").with(GisFormServlet.class);
>
>  }
>
> ...
>
> In my GisFormServlet,
>
> ...
>        HttpSession hs = req.getSession();
>
>        ServletContext sc = hs.getServletContext();
>
>        sc.setAttribute("GISVALUE", "Hello, I'm GISVALUE");
>
>
>        String next = "/submission/submission.form.vm";
>        RequestDispatcher dispatcher =
> getServletContext().getRequestDispatcher(next);
>        dispatcher.forward(req,resp);
> ...
>
> I have also put GISVALUE into the request and into the HttpSession. In every
> case, my simple submission.form.vm
>
> <html>
>
> <body>
>
>        $GISVALUE
>
> </body>
>
> </html>
>
>
>
> outputs '$GISVALUE'. No substitution is occurring.
>
>
>    Has anyone tried to integrate VelocityViewServlet and Guice? Does anyone
> have any insight into how to fix this, or even how to debug it?
>
> Any help appreciated;
>
> Garey Mills
> Library Systems Office
> UC Berkeley
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Mime
View raw message