Hi WarnerJan,

WarnerJan Veldhuis wrote:

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?


Yep using setParameter is fine. The ActionLink "value" caters for the common case where only a single value is necessary. Behind the scenes the "value" becomes another parameter.


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?


Not that I know of. Basically Velocity will behave the same as Java does. If you invoke link.setParameter("key", 1) the compiler will moan because there is no such signature. If you what some reusability you can define a ActionLink subclass which exposes a method setParameter(String key, int value).


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?


Not that I know of. If you do find time to write such a plugin be sure to let us know and we'll link to it from the website.

kind regards

bob

Reply via email to