SSH framework for understanding

Reference to some blog on CSDN ( https://blog.csdn.net/ycclydy/article/details/80451571 , https://blog.csdn.net/weixin_41876987/article/details/79649100

) And saw themselves understand the code and XML configuration files.

  1. H: Needless to say, the simplest, is an entity and mapping data in the database, a ORM, and JavaEE comes with JPA is the same, but slightly different configuration this way; in JPA by @Column annotation map, which in this configuration by the xml file;
  2. Struct2: Everyone says it is a skill a servlet (jsp is essentially like a servlet to forward), is to submit the form I understand the code can directly call the method corresponds to class action (of course, also need struct. xml configuration), and then based on the result returned by the method, the results struct automatically navigate to a JSP page (needs to be configured). This approach allows the entire form is submitted becomes particularly simple and does not need to consider is how to call the front desk to submit a form corresponding method (including how to pass parameters), because there struct done automatically. I understand this is a bit like a managed bean, first of all do not have to instantiate the class, but struct done automatically, but also the result of the method according to navigate, set the value of the managed bean is also javaEE automatically. This is indeed simpler than the managed bean, it is easy to achieve low coupling.
  3. Spring: the Internet that provide integration 1 and 2, is responsible for the management of bean (the feeling of container-managed by a third party dependency injection), is also to achieve low coupling, in the code, I feel that on the other hand, because to use this, we deliberately to achieve some of the ways to get some service classes, these classes are configured in the configuration file dwr.xml, we can see that they are created by the management of the spring, at the same time, I use the code in JSP when the corresponding object is called directly to process, and may specify callback after a call, something like the following. I think this is a little built-feeling object, similar to document this.
loginService.login(document.ThisForm.userName.value,document.ThisForm.userPw.value,0,callback);
//callback是根据login返回的数据做不同的显示

 

Published 32 original articles · won praise 5 · Views 4653

Guess you like

Origin blog.csdn.net/qq_38941327/article/details/100799343