MVC Example using Jsp, Servlets and java beans

Thursday, February 25, 2010 Posted by jagadeesh
Hi everyone upto now we we have discussed about MVC architecture.many students and beginners are developing projects using servlets or jsp. But it is not good for further modifications of that project.First project i have done using jsp and mysql. i did not use servlets and MVC architecture. So i faced lot of problems to update or modify that project.after that one of my friend told me that is not good way to do project.he told me that better to use MVC. Using MVC we can know where we have to modify code. since we are using MVC we can know easily by following MVC pattern.


Softwares : netbeans, mysql, sqlyog, and editplus.
the aim of this example is developing User Management using MVC architecture in jsp and servlets and java beans and mysql. If you have any doubt while doing this example leave your comment.i am presenting here what ever i know. if any bugs or errors in this example give me  your suggestions to modify.if you want those softwares i will provide link.submit your comment below.now we will proceed first step.


flow of this example
1. creating insertupdate.jsp
2. creating servlet
3. creating bean package and bean class
4. creating database package and database class
5. insert data in insertupdate.jsp and submit
6. get data from insertupdate.jsp and set all values to bean object
7. validate data in servlet.if it is valid send bean object to database class and insert data into  
    database.
     a. create list.jsp page 
     b. show all records from database in list.jsp
8. if it is not valid send errors to insertupdate.jsp page and display errors of errorfileds.
9. now in list.jsp page select a record to update or delete.
10. in servlet get that request from list.jsp and check it is delete or update.
     a. if it is delete send id to database class and delete record.and show the message in list.jsp
      b. if it is update send id to database class and get the details about particular id and send 
        those values to insertupdate.jsp and display all fields in that jsp and modify fields to update 
        and submit
11. get the request from insertupdate.jsp page and send values to database using bean object 
      and update that record and display that message.




Overview of MVC                                                                Creating insertupdate.jsp(View)
Labels:

Post a Comment