hi all...can anybody please referer me any site or resource containing good mvc examples or tutorials in java environment. What i partiuclary want is......
"Model-->implemented in Java Beans.....View--> implemented in Jsp and Controller--> implemented in servlet....and Database in mysql or something like that.....
All the help will be appreciated......Thank you....
.....For Every Problem There Is a Solution.....
Joined: Sep 05, 2005
My requirement is that the user should input some data like a online registration form, then those things should be validated(optional) and then it should go to the database...and in the next page those things should be retrieved from the database and displayed to the user....
Hi Ben...i went through your simpleMvc program from your site....its a good starting point....but after capturing the values in javabeans how can it be inserted to a database and again retrieved from it and displayed in a separate jsp? can you please give any ideas or hints regarding this ?? I need these things desparetely...Thank you....
It uses a mock resultSet to show one way of removing the data from the it to make it available to a scriptless JSP.
At some point, I'd like to see if I can re-write it using an embedded relational database like HSQL.
If you play with it, the thing to notice is that the AddressBook class doesn't rely on anything in the javax.servlet.* package. For that reason, it can be called from the command line and would be usable from a Servlet, Swing, command line, or any other type of application regardless of its user interface.
One of the reasons that you probably don't see too many examples that try to tie this all together is that MVC and DAO (Data Access Objects) are both designed to insure that the various layers of an enterprise web application don't rely on one another.
A good DAO layer insures that the person working on the web side has no idea what kind of database is being used (or if one is even being used). Likewise the proper use of MVC insures that web specific APIs don't bleed into the business layers of the application.
Joined: Sep 05, 2005
Thanks Ben..i went through all of your examples.....and after reading your reply...i am planning to move into struts directly.....Thank you..
I would argue against going to struts. I've just recently adopted MVC into my project I'm working on. Before I was doing a JSP code mash with all kinds of stuff in it. I too had a hard time finding examples of code that connected directly to a database, in fact I don't think I found any at all. But I have pulled my code apart and put it into the MVC model, with DB connections, result set processing into beans via servlets, and displaying the information in a table in my jsp using JSTL and EL. It works wonderfully and it is slightly faster than doing it my old way. If you want an example of some code just reply back here.