GeeCON Prague 2014*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes When to use JSF and when to use JSPs? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "When to use JSF and when to use JSPs?" Watch "When to use JSF and when to use JSPs?" New topic
Author

When to use JSF and when to use JSPs?

Antonio Fornie
Ranch Hand

Joined: Aug 07, 2008
Posts: 117
Hello all!

I'm still preparing for SCEA part 1, soon I will take it and I still have many questions :S

About Web Tier: In some mock exam questions about choosing web technology, the correct answer is to choose using JSPs or using JSPs and Servlets. In these cases I always wonder why not to use JSF instead. I'm afraid if I'm asked about choosing between only JSPs and Servlets, or JSFaces I would always choose JSFaces regardless of the scenario. So when is it better to use each one? Wich are the proper scenarios for each?

Thank you very much!

antonio

PD = I've searched for an answer but I d'dn't find it, that's why I create a new post. Hope I did right...


I feel there must be far better ways to do what I do... that makes learning even funnier
prathap venkata naga yelugula
Ranch Hand

Joined: Aug 13, 2008
Posts: 243

May be this is useful for you.

http://www.artima.com/lejava/articles/jsf_jsp.html

Cheers!
Prathap.
Antonio Fornie
Ranch Hand

Joined: Aug 07, 2008
Posts: 117
I really thank you very much. But as far as I understood, it doesn't talk about when to use servlets/jsps and when to use JSF, right?

Any link focused on SCEA?

antonio
deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 325
so lets see if this helps you.

JavaServer Faces technology is to leverage familiar UI-component and web-tier concepts without limiting you to a particular scripting technology or markup language.

JSP application cannot map HTTP requests to component-specific event handling nor manage UI elements as stateful objects on the server, as a JavaServer Faces application can
Antonio Fornie
Ranch Hand

Joined: Aug 07, 2008
Posts: 117
Thank you very much. I think this helps everybody facing the exam!

antonio
J J Wright
Ranch Hand

Joined: Jul 02, 2008
Posts: 254
At the end of the day you're always going to be using Servlets one way or another as they underpin all the Java Web technologies.

However, there are still cases where you'd use a Servlet directly. For example, if you need to stream binary data back to the client.

The point is that comparing Servlets and JSPs with JSF is not really comparing like for like. As Deepak was saying, JSF is a framework for constructing rich component-based UIs. Servlets and JSPs, assuming you're not using Facelets, are the building blocks.

The interesting questions arise when you have to choose between an action-based as opposed to component-based framework.


SCJP, SCWCD, SCBCD, SCEA 5
Antonio Fornie
Ranch Hand

Joined: Aug 07, 2008
Posts: 117
Thank you too! Yes, that good be an interesting question, but I don't think it may come in the SCEA exam. For me Struts or Stripes are action-based frameworks, but I think using servlets and JSPs it's not considered action based at all. I don't think Sun wants to talk about action-based frameworks, as they don't have it self and as Struts was the non-standard solution for web applications during so many years, forgetting about Servlet/JSPs as a serious option.

antonio
prathap venkata naga yelugula
Ranch Hand

Joined: Aug 13, 2008
Posts: 243
Good Discussion Friends.

Cheers!
Prathap.
J J Wright
Ranch Hand

Joined: Jul 02, 2008
Posts: 254
I don't think Sun wants to talk about action-based frameworks, as they don't have it self


I think it's a big mistake to rule out action-based frameworks purely because Sun has made JSF, a component-based framework, part of the Java EE standard. The old adage that one size does not fit all applies here, as even the most ardent supporter of JSF would not argue it should be used in every circumstance.

You probably won't get questions on action- vs component-based frameworks in part 1, but it's a decision you'll have to make in part 2. Personally, I don't think justifying the use of JSF purely on the grounds "it's from Sun" cuts it. You need to understand the implications for the various non-functional requirements if you're to argue your case effectively.
 
GeeCON Prague 2014
 
subject: When to use JSF and when to use JSPs?