velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baisak, Ranjan" <ranjan.bai...@razorsight.com>
Subject RE: Velocity integration with Spring
Date Mon, 15 May 2006 17:51:30 GMT
Yes Bubna, you are right.
I could able to see everything without any exception.

thanks
-R

-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: Mon 5/15/2006 1:47 PM
To: Velocity Users List
Subject: Re: Velocity integration with Spring
 
I'm fairly sure that you should be be adding your message and homeuris
to the model (which i believe should be a Map) rather than to the
view.  also, when you use any of those things in your template, you
should be doing just $message or $homeuris rather than
$req.getAttribute('message')

On 5/15/06, Baisak, Ranjan <ranjan.baisak@razorsight.com> wrote:
> The Spring controller contains following codes
> public ModelAndView handleRequest(HttpServletRequest httpServletRequest,
> HttpServletResponse httpServletResponse) {
>
> Collection channels = channelDAO.getHomeUris();
> ModelAndView view = new ModelAndView("index","channelDAO",channelDAO);
> view.addObject("message",greeting);
> view.addObject("homeuris",channels);
> return view;
> }
>
> In Velocity template, When I am trying to use channelDAO or message or homeuris collection
it returns following exception
>
> Velocity code:
> #set($greeting = $req.getAttribute("message"))
> $greeting
> #set($channelDAO = $req.getAttribute("channelDAO") )
> #set($channels = $req.getAttribute("homeuris"))
> #foreach ( $item in $channels)
> On this iteration, \$item refers to the value $item.
> #end
>
> Exception:
>
> (app.VelocityEngine 43 ) RHS of #set statement is null. Contex
> t will not be modified. /html/index.vm [line 90, column 17]
> (app.VelocityEngine 46 ) org.apache.velocity.runtime.exception
> .ReferenceException: reference : template = /html/index.vm [line 91,column 17] :
> $greeting is not a valid reference.
> (app.VelocityEngine 43 ) RHS of #set statement is null. Contex
> t will not be modified. /html/index.vm [line 92, column 17]
>
> I am sure messageDAO, or homeuris or homeuris has been initialized before adding to view
object.
> Any suggestion?
>
> regards,
> Ranjan
>
>

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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message