You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Daniel Haensse <ha...@swissembedded.com> on 2006/08/13 12:49:14 UTC
Re: Servlet and myfaces
Hey Dani,
that is really a greenhorn's question ;-)
check this
http://wiki.apache.org/myfaces/AccessFacesContextFromServlet
http://mail-archives.apache.org/mod_mbox/myfaces-users/200606.mbox/%3C003b01c69b76$f32c22c0$6701a8c0@laptop%3E
The servled would look like this, the managed bean has the name "appModel" and
class AppModel in this example
public class CompressImages extends AbstractFacesServlet {
protected void processRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// Get faces context
FacesContext facesContext = getFacesContext(request, response);
AppModel appModelBean = (AppModel)
getManagedBean("appModel",facesContext);
// We only serve request with valid session !!!
if (appModelBean==null) {
java.util.logging.Logger.global.info("Bean is null.");
return;
}
else {
java.util.logging.Logger.global.info("Got bean.");
}
regards
Dani