my dog learned polymorphism*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Front Controller doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Front Controller doubt" Watch "Front Controller doubt" New topic
Author

Front Controller doubt

Kumar Ala
Ranch Hand

Joined: Apr 30, 2009
Posts: 53

When i talk about Front controller in J2ee can i say that Servlet (or) JSP (or) JSF can used to implement ..?


kumar
SCEA5 P1
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi Kumar,

I think Front Controller is a servlet thing. You could argue that a JSP is a special type of servet (it gets converted into servlet once compiled) but usually you'd want all your requests to go through the normal servlet and then dispatch to the jsps to render the views. In the case of JSF it has its own servlet, FacesServlet.


Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
prathap venkata naga yelugula
Ranch Hand

Joined: Aug 13, 2008
Posts: 243
Hi,
Front Controller concept only reflects Servlet.

Cheers!
Prathap.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

I respectfully disagree.

This website here uses a Front Controller:

http://www.hiberbook.com/HiberBookWeb/learn.jsp?tutorial=23whatishibernate

Every single request goes through a single, front-controller. And, how is the front controller implemented? It's implemented very elegantly within a JSP. It's a front-controller in every sense of the word, and it's a JSP.

-Cameron McKenzie
deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 325
Do we have have specific advantage of using JSP as Front controller over Servlet in the web application ?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

JSPs provide great simplicity. Extremely complex applications and frameworks like Struts and JSF use a Servlet as the front controller. My website needed to adapt to changes very quickly, provide constant content updates, and allow for quick deployment and testing. The simplicity of using a JSP was perfect for what I needed.

It's always about the right tool for the job.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

BTW, since we're talking about the exam, on the exam I'd recommend a Servlet, or more to the point, I'd recommend a framework like JSF be used, and the fronting servlet would be the FacesServlet provided by the JSF framework.

JavaRanch is a great place to debate style and architecture. The SCEA exam is not the place to get fancy, or to try and over-simplify. On the exam, they want to see a Servlet, either written from scratch or pulled from a framework.

-Cameron McKenzie
Kumar Ala
Ranch Hand

Joined: Apr 30, 2009
Posts: 53
so , when i talk with respect to SCEA, can say that Servlet (or) JSF can be used as Front Controller.
I don't see any where in sun site recommending about implementing Front Controller using JSP though it can be done.
Marut pandey
Ranch Hand

Joined: Mar 10, 2008
Posts: 43
If in option there are radio buttons, i would select "servlet" and if check boxes with expected 2 correct answers. I would select Servlet and JSF

According to sun specification JSF's architecture is similar to ASP.NET, which is more page-centric than controllercentric.
prathap venkata naga yelugula
Ranch Hand

Joined: Aug 13, 2008
Posts: 243
Hi Cameron Wallace McKenzie ,

Thanks for Good Information. We are always thinking in Servlet point-of-view Only.

Cheers!
Prathap.
emanuel petre
Greenhorn

Joined: Mar 13, 2008
Posts: 14
Cameron Wallace McKenzie wrote:I respectfully disagree.

This website here uses a Front Controller:

http://www.hiberbook.com/HiberBookWeb/learn.jsp?tutorial=23whatishibernate

Every single request goes through a single, front-controller. And, how is the front controller implemented? It's implemented very elegantly within a JSP. It's a front-controller in every sense of the word, and it's a JSP.

-Cameron McKenzie


Let me disagree with you.
In the Core J2EE patterns is very well explained why a servlet controller is a preferred strategy over a jsp controller and why in fact the jsp approach is not so elegant.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/FrontController.html
Struts and JSF did themselves a complex work, but that exactly for making the development simple. After all is much more elegant and flexible to have the mappings in an XML file instead of changing in a JSP page the logic of handling requests.
 
 
subject: Front Controller doubt
 
Similar Threads
Part 2 design doubt:SCEA help
using stateful and stateless session bean together, what happens?
difference in patterns
Using struts2 only for internationalization
Design Pattern doubt.