Correct structure for working with java (JSP)

1

I'm starting to develop with java (jsp). And I would like to know the correct structure of working (only with "pure" java).

It would be this:

model (Classes with get and set)    dao (classes that extends the connection class) (for each class of the model package I have a DAO that accesses the database)

Do I need another package to have business rules? or should I implement it in the model?

    
asked by anonymous 27.07.2014 / 02:19

2 answers

1

Since you asked about patterns ...

The most common is the Model-View-Controller (MVC) standard:

  • Model: Class where is the business logic and logic of the program. Eg: EJBs, Beans, DAOs.
  • Controller: Class that takes requests made by View and passes them to Model.
  • View: Class that shows the data to the client. Eg JSP or JSF pages

On "pure java", just use it in classes and servlets, NEVER do this on JSP pages. Instead, look for an alternative, such as JSTL .

I advise you to take a look at some tutorials on the internet, about MVC in general. To learn more about the pattern, I've used this MVC tutorial in PHP , the MVC wikipedia page > and TheJavaGeek tutorial for MVC in Java .

    
30.07.2014 / 17:10
0

Hello,

I would indicate that you start with the basics, take simple examples of MVC (Model-View-Controller) standards to start your architecture and web java studies.

Here are some interesting links about java web, using very basic MVC architectures.

Caelum's Java web-based handbook, which covers everything from the basics of the web java, to the use of more complex frameworks like Spring MVC, as well as presenting essential design patterns such as DAO Pattern: link

Simple quick English tutorial: link

    
28.07.2014 / 18:38