• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

MVC, Struts, EJB - please explain

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm not sure if this is the right forum, but I'd like to know your advice.
I've cleared SCJP with 90% and currently work on j2ee and its mostly been jsp, servlets work. So far, I've learnt to avoid putting business logic in either of these. I try to follow basic MVC architecture that I've read in 1st-2 chapters HFSJ book i.e to use JSP as view, Servlet as controller and put most of the logic in a separate class (model). All I do is create object of the model class in the Servlet and call its methods to do things for me and then forward results to JSP.
This works fine, but now I wonder then what is Struts and EJB ? Are they not MVC architecture ? Could someone please tell me how is Struts different from EJB and what purpose both solve ? The way I'm doing as explained above is that not correct then ? What books/articles should I read.
Any advice is highly appreciated.
Tks,

Raj
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Bhandari:
I wonder then what is Struts and EJB ? Are they not MVC architecture ? Could someone please tell me how is Struts different from EJB and what purpose both solve ? What books/articles should I read.



Struts and EJBs are two different beasts. Struts is a framework that implements MVC architecture. So you are right in that aspect. The framework gives you hooks which you plug your code into and your application turns into this MVC thingy.

EJB is a specification written by Sun which 2 groups of people should satisfy.
First group is the people who write containers ( IBM, Weblogic, JBoss, Oracle ) and the second group are the poor developers. Now if you write your code according to EJB specs you get lot of special features for free ( the container writers ensure that ) - like - Transaction, Security, Scaling, Caching, and so many things which the developers need not write code - as the wise say - reinventing the wheel. So the developers just worry about the business logic and leave the other bigger worries to the container developers.

And for you to ponder - you can have a struts application with EJB !! Also find out about Session Beans, Entity Beans and Message Driven Beans - Great concepts.

Good luck !!
 
Raj Bhandari
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venkatraman,

Tks for the overview. I also visited your blog which has 2 articles on Struts. Its really helpful. I'm getting the impression that currently I use a plain java class to handle the business logic and struts is using a servlet (other than the controller) to do the business instead of using plain java class. EJB seems like a different beast at this moment and with time hopefully I'll get a better understanding.
Tks

Raj
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the Struts forum.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic