File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes implementing project using mvc architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "implementing project using mvc architecture" Watch "implementing project using mvc architecture" New topic

implementing project using mvc architecture

Soni Mitesh
Ranch Hand

Joined: Sep 02, 2007
Posts: 33
Hello, ranchers

i am seeking guidance that the current existing project is
in really bad shape, all the pages are in jsp, not architecture was followed.
I have to manage the project and convert the whole project in simple MVC or struts mvc architecture.
please guide me, what would be the sequential steps to implement it.

if any reference book mentioned would be also great help
Thank you in advance.
suchit pandya
Ranch Hand

Joined: Oct 27, 2009
Posts: 43

If you want to know about MVC architecture then you can read head first servlets.
Basically in MVC structure in jsp pages html and any other language such as java script or EL are allowed but i had seen some people use java code in JSP also but its not preferable.

In MVC its model - view and controll. In MVC you need to saperate presentation from business logic. What is wrong currently in your structure?
gaurav kant

Joined: Oct 06, 2008
Posts: 14
If you are looking for MVC then you have many choices, here i am suggesting you two of them
1. Follow MVC in your current running Project.
a) create a controller servlet that will decide the flow
b) For all the business logic create beans and access these beans in your JSPs
c) All the presentation includes in JSPs using EL or JSP tags or scriptlets
i don't think that using scriptlet in JSP is a bad thing. But you must not put your business logic in JSPs or big codes should not be placed on JSPs. If you need some small codes just put in JSP. I agree that scriptlets should not be used in JSPs but it can be used for small codes.

2. Follow Struts:
Its a good practice to follow struts framework. This framework is based on MVC architecture. It make the system robust, powerful and well designed.

Please correct me if i am wrong at any point
Soni Mitesh
Ranch Hand

Joined: Sep 02, 2007
Posts: 33
one more hinderance,
now the manager has asked me not to use struts for implementation of the project,
so not to use struts and have it into MVC based architecture product.

ranchers i do think that

creating controller will give me some extent of MVC,
but i feel it will give me MV+C architecture.

if any guidance please let me know,
and if any book suggestions are there please mention its name.

Thanks in advance
gaurav kant

Joined: Oct 06, 2008
Posts: 14
Then why don't you go for 1st option given by me in last reply ....
I agree. Here's the link:
subject: implementing project using mvc architecture
jQuery in Action, 3rd edition