• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where is the Busness logic in Model 2 pattern

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to know where is the Busness logic in Model 2 pattern?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Business logic comes in Model in MVC 2 architecture.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya.i know that.
let say there is a jsp,servlet and bean class

Model = bean
controler = servlet
view = jsp

then where is the buiness logic.
is it in the servlet or other?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends upon where are you declaring the business logic, If you put it in bean, then bean act as a model, if you put all the logic in Servlet itself, because your application is small, then model is Servlet. If you use the scriptlets to define all the logic in the JSP itself, then JSP becomes Model.

Usually, people use helper class, utilty class, pojo, etc, to define the business logic.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't understand what are you saying.
As example if i need the get the resuld of my one subject.
i enter my username and subject.I need to get the result of that subject.

1)then how the buiness logic define in jsp?
2)normally what is the standered way to do this if i use MVC2 architecture?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:i don't understand what are you saying.

Neither do I
Samanthi perera wrote:As example if i need the get the resuld of my one subject.
i enter my username and subject.I need to get the result of that subject.

1)then how the buiness logic define in jsp?

Using scriptlet, as I said earlier.
Samanthi perera wrote:2)normally what is the standered way to do this if i use MVC2 architecture?

Serach.jsp(V) -> Sevlet(C) -> Class_with_JDBC_Logic(M) -> result_bean(M) -> Result.jsp(V)

And please check your spells.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that means there can be more than one class in Model ,View or Controller?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:that means there can be more than one class in Model ,View or Controller?

of course, each M, V and C consist of set of classes interacting with each other. Controller is only one, one class.
For S1, its org.apache.struts.action.ActionServlet
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic