They're very close to equivalent, but not exactly. The special _eventName
parameter overrides all other means of specifying the event name. (The other
ways are: event name as parameter; append event name to path; and $event
with clean URLs, which is really the same as the first.) So if you use
{$event} instead of {_eventName} in @UrlBinding you can still override the
value specified for {$event} by sending a different value for _eventName in
the GET query string or POST request body. It would be unusual, but I just
thought I'd point out the difference.

Another difference is what you've discovered on your own. The {$event}
construct gets special treatment when building URLs, whereas {_eventName}
does not.

-Ben

On Sat, Nov 20, 2010 at 1:50 PM, Nikolaos Giannopoulos <
nikol...@brightminds.org> wrote:

> Levi,
>
> Because they are equivalent ;-)
>
> No.  Seriously.  Because {$event} can get easily confused with EL
> ${event} in Url bindings whereas {_eventName} is pretty explicit and
> obvious.
>
> I know I personally will probably not make the same mistake twice but
> other developers working on the code might.
> This came up a while back when a typo in Freddy's book resulted in code
> that didn't work.
>
> In the end, both are fine, one just "appears" more explicit.
>
> --Nikolaos
>
>
>
> Levi Hoogenberg wrote:
> >
> > Why are you using {_eventName} instead of {$event}?
> >
> >> Op 20 nov 2010 19:29 schreef "Nikolaos Giannopoulos"
> >> <nikol...@brightminds.org <mailto:nikol...@brightminds.org>>:
> >>
> >> gshegosh,
> >>
> >> Much Appreciated. The following was 99% there:
> >>
> >> return (new RedirectResolution(ArticleActionBean.class,
> >> "view").addParameter("authorId",
> >> this.article.getAuthorId()).addParameter("id",
> >> this.article.getId()).addParameter("titleUrlified",
> >> this.article.getTitleUrlified());
> >>
> >> As it resulted in:
> >> /web/article/245b57557f0d3c57/2/magic-or-science?view=
> >>
> >> This appears to be a bug as it should have injected the event in the
> >> clean Url. No?
> >>
> >> Whereas the following worked perfectly:
> >>
> >> return (new
> >> RedirectResolution(ArticleActionBean.class).addParameter("authorId",
> >> this.article.getAuthorId()).addParameter("id",
> >> this.article.getId()).addParameter("titleUrlified",
> >> this.article.getTitleUrlified()).addParameter("_eventName", "view"));
> >>
> >> Correctly resulting in:
> >> /web/article/245b57557f0d3c57/2/magic-or-science/view
> >>
> >> --Nikolaos
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to