| How do I access Request or Session from Seam? |
| Written by Mark S. | |||||
|
Two ways : 1) Easy way: use ServletContexts.instance().getRequest() in your backing bean. 2) Define a factory in your component descriptor and inject the HttpServletRequest or HttpSession directly into your Seam component.
<factory name="httpRequest"
value="#{facesContext.externalContext.request}"
auto-create="true"/>
<factory name="httpSession"
value="#{facesContext.externalContext.request.session}"
auto-create="true"/>
@In HttpServletRequest httpRequest;@In HttpSession httpSession; If on the other hand you don't need the HttpRequest but only the request parameters, simply use the @RequestParameter("parameterName") annotation which inject into your component the value of a request parameter
JBoss.org Search
Custom Search
Only registered users can write comments!
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |


