users@javaserverfaces.java.net

No alternative for _at_ManagedProperty to get request parameters

From: <hildeberto_at_yougi.org>
Date: Thu, 31 Oct 2013 09:22:20 +0000 (UTC)

 I was working on a refactoring to migrate from @ManagedBean to @Named,
but the application stopped working. After some debugging I realized
that the annotation @ManagedProperty was not working anymore, since it
needed the @ManagedBean in place. To get references to other managed
beans I have replaced @ManagedProperty by @Inject, but to get request
parameters in the URL (i.e. ?id=987) I don't find an alternative within
the framework.

This issue is widely reported in StackOverflow, where some people
suggested workarounds for the problem using <f:viewParam> and a
homemade annotation @HttpParam to deal with the problem.

Unfortunately, when I use <f:viewParam> the value is not available for
my @PostConstruct method. I would have to add <f:viewAction> to achieve
the same behavior, but in the end, I ended up with much more code to do
the same thing using CDI, when the natural logic is to simplify. Also,
a home made solution would imply in much more code, which falls in the
same issue.

Have a look at the code:
https://github.com/htmfilho/architect/blob/master/src/main/java/com/hil
d.... The line 74 never executes.

Is anybody already looking at this issue or should I create a new issue
for that?