we have one application that uses one front controller servlet,which invokes model via action and then sends it to view (jsp ),it is similar to struts.now we want to use JSF also in that application. My question is how we can integrate our front controller servlet with face servlet. [ June 08, 2007: Message edited by: indraNJ sen ]
As your Front Controller is similar to Struts there are two books I have seen each with a chapter on how to convert from Struts to JSF if that is an option for you.
Thanks Majid. It is like struts but not actually struts. our front controller depends on which action name is passed invokes the command bean(action ) and views(jsp ). our front controller manages the session,security. so i can not bypass our front controller . My question is can i invoke face servlet from our controller servlet? Thanks in advance...
I have not read the chapters that Majid refers to but we solved a similar problem. FacesServlet is mapped to a url pattern in web.xml - generally, /faces/* or *.faces or *.jsf. Dispatching a request from your controller to a resource matching the url pattern will invoke FacesServlet.
It seems you want to make your new UI development using JSF but don't want to change the old code. I see it very feasible.
I agree with Joseph that dispatching your request to the JSF servlet should work. I am trying to see what other important things you may need to consider.
What about the relation between your backing beans for the new JSF views and your actions you might have already? How will you pass information from the UI components to the actions and reflect results of the actions back to the UI?
I really can't see the whole picture but it looks like an interesting journey.
It is quite feasible if you know what you're doing. The backing beans are ordinary JavaBeans for their corresponding scopes and they posess no inherent magic - a bean created by a Servlet or Struts Action in Session scope is completely the same as it would be if JSF created it and vice versa - there's no hidden payloads that get in the way of trading them back and forth.
Although this isn't true if you start adding framework-specific code to your bean class. Which is another reason why backing beans work best as "pure" JavaBeans and not framework-specific JavaBeans.
I have not read the chapters that Majid refers to but we solved a similar problem. FacesServlet is mapped to a url pattern in web.xml - generally, /faces/* or *.faces or *.jsf. Dispatching a request from your controller to a resource matching the url pattern will invoke FacesServlet
Thanks Joseph.Can you send me some sample code of invoking face servlet from my front controller servlet. Thanks in advance..