>From: <[EMAIL PROTECTED]> > > Hi. > > We are trying to integrate Struts and JSF. Is it possible to populate a JSF > Managed Java Bean from a Struts Action class? > If so, is there an example somewhere? >
This can be done when you run both struts action and faces servlet controllers. You will need to give the faces servlet a prefix url mapping and the action servlet a suffix mapping. <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> All your struts action requests need to be dispatched through the faces servlet so that the all all knowing FacesContext is created. Then in your struts action, you can use the FacesContext the same way you would in a managed bean action callback. public ActionForward doLoad( IRusttsActionMapping mapping, ActionForm form, HttpServletRequest request, ActionMessages messages) throws Exception { FacesContext facesContext = FacesContext.getCurrentInstance(); ActionForm formBean = (ActionForm) facesContext.getApplication().getVariableResolver() .resolveVariable(facesContext, "AboutDynaForm"); // -- or -- ValueBinding vb = facesContext.getApplication() .createValueBinding("#{AboutDynaForm}"); formBean = (ActionForm) vb.getValue(facesContext); > Thanks in advance, > > --Brad Simonin. > Gary > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >