• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Front Controller doubt

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ..?
 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Front Controller concept only reflects Servlet.

Cheers!
Prathap.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No more fooling around. Read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic