JSF 2.0 + Spring 3 retrieving request parameter via annotation

In a native JSF 2.0 environment, a user can refer to query parameters with something like

@ManagedProperty("#{param.id}") private Long id; 

However, I use Spring to manage the JSF beans, so the @ManagedProperty annotation is ignored in my case. You can still use the # {param.id} operator in faces-config.xml, but annotation-based configuration is obviously much preferable.

Is there a way to resolve such statements using Spring annotations?

+4
source share
1 answer

You can use @Value with the Spring expression language. The request variable is available:

 @Value("#{request.getParameter('id')}") private Long id 
+3
source

Source: https://habr.com/ru/post/1379038/


All Articles