aspose file tools
The moose likes JSF and the fly likes invoke face servlet from another front controller servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "invoke face servlet from another front controller servlet" Watch "invoke face servlet from another front controller servlet" New topic
Author

invoke face servlet from another front controller servlet

indra sen
Greenhorn

Joined: Jun 08, 2007
Posts: 27
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 ]
Majid Al-Fifi
Ranch Hand

Joined: Aug 22, 2006
Posts: 45
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.

1. JavaServer Faces: the complete reference
2. Mastering JavaServer Faces (oreilly)


SCJP1.4, SCWCD1.4
indra sen
Greenhorn

Joined: Jun 08, 2007
Posts: 27
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...
Joseph Miller
Greenhorn

Joined: Jun 19, 2001
Posts: 21
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.

--
Joe
Majid Al-Fifi
Ranch Hand

Joined: Aug 22, 2006
Posts: 45
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.

Please let us know how it goes with you.

regards,
Majid
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
indra sen
Greenhorn

Joined: Jun 08, 2007
Posts: 27
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..
indra sen
Greenhorn

Joined: Jun 08, 2007
Posts: 27
can any one help me with sample code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invoke face servlet from another front controller servlet
 
Similar Threads
Component dispatcher sevlet
Single Servlet vs. Multiple Servlet approach
Front Controller doubt
SCEA Part II - Client side
why do we need Application Controller?