You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Nathan Bubna <nb...@gmail.com> on 2006/05/15 16:23:20 UTC

Re: syntax: method with parameter

if the method takes a parameter, you cannot use the abbreviated
syntax.  so, if the method is getProfilePath(String userName), then
you should be able to do:

${action.getProfilePath("$forum.lastPostUserName")}

On 5/15/06, superoverdrive@gmx.de <su...@gmx.de> wrote:
> Whats wrong with:
>
> <A href="${action.ProfilePath("$forum.lastPostUserName")}">
>
> ?
>
> How would you call a method that takes a variable as a paramter?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

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


RE: Velocity integration with Spring

Posted by "Baisak, Ranjan" <ra...@razorsight.com>.
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 <ra...@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



Re: Velocity integration with Spring

Posted by Nathan Bubna <nb...@gmail.com>.
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 <ra...@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


Velocity integration with Spring

Posted by "Baisak, Ranjan" <ra...@razorsight.com>.
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