Hi Malcolm,
Here's what I am trying to do:
#foreach ( $object1 in $collection1)
#foreach ( $object2 in $collection2)
$actionlink.setParameter("object1", "$object1.id")
$actionlink.setParameter("object2", "$object2.id")
<a href="$actionlink.href">$object2.description</a>
#end
#end
As you can see, the ActionLink is reused in the two iterations. Are you
saying that I shouldn't do that? I am happy to move this to the Page
class, but I am not sure if I am supposed to create a lot of ActionLinks
on the fly like this or reuse the existing one.
Cheers
WarnerJan
On Wed, 2009-04-08 at 19:08 +1000, Malcolm Edgar wrote:
> Hi,
>
> I have never actually set an actionLink parameter in a Velocity page
> template, I have always done it in the Java Page class. I think
> performing this kind of initialization is best done in the Page if you
> can.
>
> regards Malcolm Edgar
>
> On Wed, Apr 8, 2009 at 5:41 PM, WarnerJan Veldhuis
> <[email protected]> wrote:
> > Hello List,
> >
> > New user of Click here, but I am very enthousiastic!! I love the simplicity.
> >
> > Here's my question: I am using an ActionLink to let the user select an
> > object on screen. I know the ActionLink supports one extra value in
> > getHref(Object), but this object must be selected with TWO values. This is
> > what I am currently using, and it works (names have been changed to clarify
> > a bit):
> >
> > page.htm
> > $actionlink.setParameter("id1", "$firstObject.id")
> > $actionlink.setParameter("id2", "$secondObject.id")
> > <a href="$actionlink.href">$someName</a>
> >
> > In the backingclass I can access the parameters with
> > actionlink.getParameter("id1") etc.
> >
> > Is it good practice to use parameters in this situation? Or should I
> > concatenate the id's for use in getHref(Object) and split them in the
> > backingclass?
> >
> > Second, Velocity doesn't like setParameter(String, int). It won't get
> > parsed. Surrounding the ints with quotes works, but it's fugly. Any way to
> > change that?
> >
> > Thanks for your comments, and keep up the good work! If time permits, I'll
> > look at creating a Click support plugin for IntelliJ if it doesn't exist.
> > Does it?
> >
> >
> > WarnerJan Veldhuis
> >
> >
WarnerJan Veldhuis
QPR CostControl BV
Clarissenhof 15
4133 AB Vianen
Tel: +31(0)347 355023
Helpsdesk: +31(0)347 355027