org.jboss.solder.servlet.http
Annotation Type RequestParam


@Qualifier
@Target(value={TYPE,METHOD,PARAMETER,FIELD})
@Retention(value=RUNTIME)
@Documented
public @interface RequestParam

Qualifies injection points that should have their values fetched from a corresponding HTTP request parameter (i.e., query string or form parameter).

Example explicit usage, assuming a servlet path /book.jsf?id=3

 @Inject
 @RequestParam("id")
 private String bookId;
 

Example implicit usage, assuming the same servlet path

 @Inject
 @RequestParam
 private String id;
 

Example explicit usage with default value

 @Inject
 @RequestParam("id")
 @DefaultValue("1")
 private String bookId;
 

Because the bean produced is dependent-scoped, use of this annotation on class fields and bean properties is only safe for request-scoped beans. Beans with longer scopes should wrap this bean in a provider and retrieve the value on demand.

 @Inject @RequestParam("id")
 private Instance<String> bookIdProvider;

 ...

 String bookId = bookIdProvider.get();
 

Author:
Nicklas Karlsson, Dan Allen

Optional Element Summary
 String value
           
 

value

public abstract String value
Default:
""


Copyright © 2008-2011 Seam Framework. All Rights Reserved.