• Post Reply Bookmark Topic Watch Topic
  • New Topic

What Should be MVC structure of Java Classes for Web Application Project  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am designing a Web application in which I am using Spring+Hibernate+jsp+servlet+java Programming+Oracle database.

I want to what should be MVC structure for placing these class like Model classes,Controller classs,View classes,Service classes.

Although I have read many things abonut DAO,Busineess Service.

But I am not able to figure out where I should place which class in which folder.

Any refernce point or idea to find out where to place which class


Thanks
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Web frameworks are MVC implementations so if you are using a web framework then you should that framework's documentation/recommendations on where to place what. It will be different for different frameworks.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I will read it more about this there


 
Knute Snortum
Sheriff
Posts: 3947
92
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Spring and I typically have a model package for all my entities, an mvc for my controllers, and a dao for my data access objects. This is just a suggestion: you could use "controller" for your controllers or whatever. It should be consistent and understandable.

You can see how I use this here.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply

But my question is how to identify what is dao and what is model in java classes

Do you have any key criteria,rule so that I can identify them where to place

I am also using spring+hibernate+oracle+jsp+servlet

 
Knute Snortum
Sheriff
Posts: 3947
92
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, a model is roughly an object or entity. It's one "thing" that you're going to put in the DB, like a book. You might have Book.java; that would go in "model".

A DAO is a data access object, so it's your interface between the model and the DB. Typically this is where you'd put your queries or hibernate statements for a model. So you might have BookDao.java and in it you might have:



Does that answer your question?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!