MVC Example using Jsp, Servlets and java beans

Thursday, February 25, 2010 Posted by Unknown
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:
  1. hey jagadeesh kumar... do u have any mvc jsp example explained in the article....?

    seems my jsp need some mvc pattern here.
    Hehehe...

    urgent mode on.

  2. its really good jagadeesh..its very usefull thing to me.:)

  3. Anonymous

    Thanks alot thats the thing i was looking for

  4. Thanks for your comment. actually this is my first app using mvc. still i have to change lot of things. planning for video tutorial for this mvc example. asap i will post

  5. I need the link for this mvc project.

  6. When I try to open insertupdate.jsp its does not open.
    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

  7. This is a simple Model View Controller (MVC) tutorial, although this is a very small application it uses the MVC model approach which proves that even small applications can use MVC. The following is what we will be doing in this tutorial,

    Writing an HTML form page
    Creating a Servlet controller - Controller
    Creating the Model (a plain old Java class) - Model
    Creating an XML deployment descriptor
    Creating an JSP View - View



    http://www.datadisk.co.uk/html_docs/jsp/jsp_mvc_tutorial.htm

  8. how to use mvc in my project i want clear details with example

  9. Thanks for visiting my blog. I am not updsti this blog.you can follow my new blog here http:// jagadeeshmanne.blogspot.com .You can download this example in my blog. I suggest you to learn grails will take 5 mins to build crude application including design. Let me know you need any help

Post a Comment