Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Front Controller doubt

 
Kumar Ala
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When i talk about Front controller in J2ee can i say that Servlet (or) JSP (or) JSF can used to implement ..?
 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
prathap venkata naga yelugula
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Front Controller concept only reflects Servlet.

Cheers!
Prathap.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cameron Wallace McKenzie ,

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

Cheers!
Prathap.
 
emanuel petre
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic