aspose file tools*
The moose likes Struts and the fly likes where is the Busness logic in Model 2 pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "where is the Busness logic in Model 2 pattern" Watch "where is the Busness logic in Model 2 pattern" New topic
Author

where is the Busness logic in Model 2 pattern

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
i need to know where is the Busness logic in Model 2 pattern?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Business logic comes in Model in MVC 2 architecture.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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

Joined: Jan 08, 2010
Posts: 510
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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

Joined: Jan 08, 2010
Posts: 510
that means there can be more than one class in Model ,View or Controller?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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
 
jQuery in Action, 2nd edition
 
subject: where is the Busness logic in Model 2 pattern