MVC Help
Hi
I am new to designing, I am not able to confirm whether my design explained below is a valid or proper one, should I improve in any other place.
M - Stateless session bean having methods for insert, update, delete, view,
V - Jsps, html, js, images
C - A single servlet for a single JSP
Sample
addUserGroup.jsp on submit it redirects to UGACtrler populates javabean UsrGrp and instantiates UserGroupBean ejb and calls the corresponding method for inserting or updating.
updateUserGroup.jsp on submit it redirects to UGUCtrler populates javabean UsrGrp and instantiates UserGroupBean ejb and calls the corresponding method for inserting or updating.
and it goes for all database operations.
Please suggest me whether this is a proper way of doing it.
regards
[830 byte] By [
gopalkisa] at [2007-9-29 11:38:15]

Hi
In My design I used one jsp for one functionality and one servlet for each jsp as controller for that functionality and an EJB for all the functionalities. I saw more servlets coming into picture but I felt it will be easy to maintain and code also. I feel like if one servlet is used for all the functionalities, maintaining the code I felt it will be difficult.
addUser.jsp -> addUserServlet controller -> User EJB (create method)
viewUser.jsp -> ViewUserServlet controller -> User EJB (view method)
... etc
Any comments on this design is welcome. I will also learn something if this design in purely wrong.
regards
Hi,
I think you should avoid creating servlets for each jsp.
As a controller you need one one servlet.
My understanding from your design is you are having all business logic in EJB's. In that case what is the need of many servlets.
Following modification would sound better ...
JSP1 --\/--bean1 //this can be EJB
JSP2 ControllerServlet -- bean2 //or just bean, which comunicats with EJB
.........
You can refer to working of few frameworks like struts, SunONE application framework for more info on MVC design