i have the below jsp which i want to divide into MVC(as adviced by Bear previously as the best practice. and thank you for that bear), i am unable to understand what goes unde Model, View and Controller.
you didnt employee servlet or servlet filter or some kind of controller . and here jsp is doing all the work .
in MVC, you need to define one role to one worker. normally
*JSP-best suite for view(should only contain logic for view).
*Servlet[known as controller]-he is good at delegating request to appropriate location/business logic.
*Java class-Obviously better to put your logic here.
So that, specialized people can concentrate their job with out interfering others.
and for example: jsp is best place to put html , view logic etc..
if you put their java class then it wont be convenient to maintain
[working in java code in java class is better than working in java code in jsp is in IDE]
and there are many reason why MVC is famous...
and now you move all your business logic(java code) to java class and call the class from your servlet, hence submit your form/jsp to servlet
Venkatasamy is correct but if you want you can put one more layer between your servlet and Logic layer that will be good
In this layer you just provide the manipulations you want to do with your data and logic layer will only give you the
output of the query.In this way your last layer will be unplugged any time if you want to change your databas query or
type etc. In that you just have to remove the last layer in this .If you put any manupulations with data then it will be
very dependent on that layer.
Is it clear for you or just i confuse you more..Please reply.
Thank you for the reply, It is a bit confusing, but, according to my understanding you say to seperate even DB logic from servlet and use it so that DB manuplation can be even more easy. please correct me if i'm wrong. if i'm right i'll proceed as you say.