• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

SCEA Assignment: JSF Vs Struts

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I started my SCEA5 assignment a week ago.

I have already run into a pretty vexing choice of JSF Vs Struts for my web framework.

My assignment has no requirements for a rich GUI interface. So, one would think the obvious choice would be Struts.

So, what is my problem?
1. EJB 3.0 comes with annotations. With JSF's managed beans, you can directly call EJBs using annotations without having to go thru the Business Delegate/Service Locator/JNDI hoopla. If you use Struts, you have Action classes which are not container managed, so you are saying no to annotations and yes to Business Delegate/Service Locator/JNDI hoopla.

2. On the other hand, if you dont have a Business Delegate, you tend to have a tight coupling between presentation tier and Business tier. And what if you need to provide web services in the future - isnt it better to have a business delegate around?

3. Also, more important (or maybe a silly point), will Sun examiners take kindly to you if you choose Struts over JSF.

Maybe I dont understand the perspective here. What do you think? Please share your thoughts.

Thanks,
Amar.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Spring framework to inject enterprise beans to Struts Action using org.springframework.jndi.JndiObjectFactoryBean, that can reduce pain.

Anyway, if you will use Spring why not use Spring Web MVC?
 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My assignment has no requirements for a rich GUI interface



For me the above statement would be the clincher. Whilst JSF does have the advantage of managed beans, and hence dependency injection. I do not see this as a valid reason for using it in UIs which are predominantly displaying read-only, effectively static, data. I've heard of several JSF projects that ran into serious performance problems.

Also, more important (or maybe a silly point), will Sun examiners take kindly to you if you choose Struts over JSF



I also considered this point. However, I would be very surprised, and even more disappointed, if this were the case. You should have plenty of opportunity to justify your choices in your assumptions / design patterns used documentation. I would feel pretty uncomfortable having to justify the use of technology solely on the grounds that it came from Sun and enabled me to inject EJB references, which might, as you say, be irrelevant if you want to use Business Delegates.

I think the important question you need to answer is 1) are you going to be collocating your Web and EJB tiers, and 2) if you are, do you want your architecture to be flexible enough to facilitate any future change to an N-Tier topology. If the answer to one or both of these is yes your probably going to want Business Delegates. In which case the argument for JSF is even weaker.
 
Amar Thia
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kengkaj and Jonathan,
Thank you very much for your response.

Kengkaj,
I haven't used Spring - but will investigate it further. I understand I can get info from the web on Spring - but do you happen to know of any website that can provide a quick tutorial for Spring buffs like me.

Jonathan,
I have a question on the following paragraph:

I think the important question you need to answer is 1) are you going to be collocating your Web and EJB tiers, and 2) if you are, do you want your architecture to be flexible enough to facilitate any future change to an N-Tier topology. If the answer to one or both of these is yes your probably going to want Business Delegates. In which case the argument for JSF is even weaker.



Are you saying regardless of whether you access EJBs as Local or Remote you need Business delegates. But, can't DI also help you access both Local and Remote EJBs? Or am I placing too much faith in DIs?

Again thank you both for taking the time to answer.

Thanks,
Amar.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amar Thia wrote:
Kengkaj,
I haven't used Spring - but will investigate it further. I understand I can get info from the web on Spring - but do you happen to know of any website that can provide a quick tutorial for Spring buffs like me.


I suggest to read http://static.springframework.org/spring/docs/2.5.x/reference/index.html, although it's a "reference documentation", it's easy to read, if after read document you want to know more detail about how to use those things you can read further in Spring API Javadocs.

I recommend to begin from Chapter 3. The IoC container, and Chapter 13. Web MVC framework if you interest Spring Web MVC.

Amar Thia wrote:Or am I placing too much faith in DIs?


Maybe, DI is not a must, you can still use Service Locator pattern to reduce tight-coupling to implementations.
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about a managed bean acting as a ServiceLocator?

May be not the best thing to do but some POC can use it.

Prashant
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic