n0weak
n0weak

Reputation: 750

JSF 2.0 + Spring 3, retrieving request parameter via annotation

In native JSF 2.0 environment user is able to refer to request parameters with something like

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

However I'm using Spring to manage JSF beans, so @ManagedProperty annotation is ignored in my case. It's still possible to use #{param.id} statement in faces-config.xml, but annotation-based configuration is obviously much more preferable.

Is there any way to resolve such statements with Spring annotations?

Upvotes: 5

Views: 2160

Answers (1)

mrembisz
mrembisz

Reputation: 12880

You can try to use @Value with Spring Expression Language. There should be request variable available:

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

Upvotes: 3

Related Questions