【文章內(nèi)容簡(jiǎn)介】
has a good integration function, but there is a lack of public controller. And EJB depends on the EJB containers, at the same time, it is realized plicatedly. While Struts has been applied extensively because of its advantages. At present, most of systems apply the relational databases mainly, while Java is an objectoriented language essentially. In Model part of Struts framework application, using SQL and JDBC to operate databases when storing and fetching objects reduces programming efficiency and the systematic maintainability. Traditional J2EEbased application applies heavyweight framework based on EJB that adapts to the large enterprise development, while development and debugging by EJB container need to consume a plenty of time and high price. EJB3 improves the disadvantages of original EJB, but its application is not mature yet. Hibernate can substitute ContainerManaged Persistence (CMP) to acplish heavy responsibility of permanence in J2EE framework of applying a word, Hibernate can resolve the difficulties ing from using traditional CMP, JDBC and Data Access Object(DAO) in a technological development. For reducing the coupling of code and raising systematic development efficiency, this paper suggests J2EE application development tactics based on Struts and Hibernate. The Struts design shows the MVC framework sufficiently, which all control flows need a configuration file () to manage, and which is convenient to maintain. The integration of Struts and Hibernate is that Hibernate solves the model layer of Struts, which makes developers operate Java objects instead of database. The integration shows the objectoriented thought sufficiently and solves some problems of the database operation in traditional J2EE well. Flow of Framework The flow of integration framework based on Struts and Hibernate is shown in Figure 3. At first, users send Http requests by Browser, then Http requests are accepted by ActionServlet of the control ponent in business layer, then gave to RequestProcessor which gets corresponding Action from ActionMapping by request URL[3]. Besides, ActionForm packs JSP pages, which can make a checking to data of datasheet if it is needed, send back ActionErrors to visual pages if there are mistakes and transfer the data of pages to Action if it passes validation. Request Processor transfers the “execute” method of Action and the method transfers the business logic module. Hibernate acplishes interaction of databases and JavaBean. The operation of processi