设计 任务书 文档 开题 答辩 说明书 格式 模板 外文 翻译 范文 资料 作品 文献 课程 实习 指导 调研 下载 网络教育 计算机 网站 网页 小程序 商城 购物 订餐 电影 安卓 Android Html Html5 SSM SSH Python 爬虫 大数据 管理系统 图书 校园网 考试 选题 网络安全 推荐系统 机械 模具 夹具 自动化 数控 车床 汽车 故障 诊断 电机 建模 机械手 去壳机 千斤顶 变速器 减速器 图纸 电气 变电站 电子 Stm32 单片机 物联网 监控 密码锁 Plc 组态 控制 智能 Matlab 土木 建筑 结构 框架 教学楼 住宅楼 造价 施工 办公楼 给水 排水 桥梁 刚构桥 水利 重力坝 水库 采矿 环境 化工 固废 工厂 视觉传达 室内设计 产品设计 电子商务 物流 盈利 案例 分析 评估 报告 营销 报销 会计
 首 页 机械毕业设计 电子电气毕业设计 计算机毕业设计 土木工程毕业设计 视觉传达毕业设计 理工论文 文科论文 毕设资料 帮助中心 设计流程 
垫片
您现在所在的位置:首页 >>文科论文 >> 文章内容
                 
垫片
   我们提供全套毕业设计和毕业论文服务,联系微信号:biyezuopin QQ:2922748026   
Design and Application of Java Web Software Architecture Based on the SH Middleware
文章来源:www.biyezuopin.vip   发布者:毕业作品网站  
Design and Application of Java Web Software Architecture Based on the SH Middleware
Ⅰ. INTRODUCTION
Java technology is currently a popular language for Web development. Java Web development model has been widely used in developing B/S software application. The development of Java Web technology is attributed to the development of Internet and Browsers.
There is a significant improvement in B/S structure based software in comparison with C/S structure based software. The client code and the server code of C/S structure based software must be stored in the client and the server, respectively. The client requests to the server, the server responses and then returns the result. It brings a lot of inconvenience for the application and the maintenance because each client must install the client code.
The client of B/S structure based software is Browser. The client code and the server code are stored in Web containers (Web server). The user sends a request to the server by the client Browser, the client code is downloaded to the client computer and runs in the Browser. It no longer requires the client computer to install the client code, which is different from C/S structure based software. Thus, not only the working capacity of system maintenance on the client computer is significantly simplified, but also the operation for the user is simple and consistent.
B/S structure based software on Java Web has been constantly improved. Model1 (JSP+JavaBean) and Model2 (JSP+JavaBean+Servlet) have been developed sequentially. The latter realized the MVC model (Model+View+Controller). The trend of B/S based software development becomes more and more hierarchical in structures.                                                                            The objective of hierarchy is to separate the data from the program, separate the business logic from the display logic and separate the database management from the business logic. The hierarchical structure is good to the system expansion, so that the impact on the whole system caused by certain layer change  can be minimized.
Presentation layer: provides user certain operation interfaces, receives the client requests, and displays the response results. It also recognizes small of amount of business logic.
Business layer: recognizes the main business logic. The business code is independent, so that there is no need to know how and where to display. In addition, it is also independent to the backend database.
Data layer: is an independent backend data resource. The data can be used by different programs. Currently, the typical data resource is the relation database.
The hierarchical Web software application has rapidly become the main stream of the Web application due to the above advantages.
Ⅱ. SH TECHNOLOGY
The author has studied the architecture and design technology of Java Web software application based on SH middleware, and applied them in developing a project.
A. Struts
Struts2 is an open resource of presentation layer middleware in Java development platform. It recognizes the MVC pattern of presentation layer and it separates the view and control at presentation layer successfully. Struts2 consists of three parts: the core controller Filter Dispatcher, the logic controller Action and the view components.                                            Filter Dispatcher is a Filter running in the Web application. It is responsible for intercepting all client requests, then determines which Action handles the client request through reading a configuration file “struts.xml”.
Action obtains the information, such as client request parameters and performs business processing. It also transfers the processed results to the client display components, such as JSP, FreeMarker, Velocity, and so on .
B. Hibernate
Hibernate3 is an open resource of data layer middleware in Java development platform and a mapping tool for object/relation database. It maps the entity object to a relation database very well, shields the relation database from application software, encapsulates the relation database access into the object access, and provides an unified data access interface for upper layers.
Hibernate3 not only provides the bidirectional mapping from Java class to data table, but also supplies the mechanism for data query, data alter, data repair and data recovery. Hibernate3 can be used in J2EE and J2SE application softwares in JDBC. Hibernate3 provides HQL (HibernateQuery Language), which can be used to fully access the date resources in object-oriented way.
Ⅲ. THE SOFTWARE ARCHITECTURE BASED ON SH
The authors introduced SH (Struts2+Hibernate3) middleware during the development of their project “The Design of the System for Zhanjiang Meteorological Forecast(0910262)”. Struts2 is introduced into presentation layer and Hibernate3 into data layer.
JSP: It is the client page, using Struts2 tags and receiving  the client data from POJO in the form.
Action: It is the Struts2 Action Class, its private attributes are consistent with POJO of JSP form. Action does not need to perform large amount of business process. The major amount of business process is accomplished by business layer. Action class calls the business interface methods at business layer.
Business interface: It is a facade of business layer, which defines all business methods in a module. Each module of application software should have this interface to isolate the presentation layer from the business layer. The presentation layer and the business layer are coupled through the interface, so that it can reduce the interaction between the layers and is preferred by software expansion.
Business implement: It is the implement class for business interface, implementing all kinds of business functions of the software。
DAO interface: It is the data access interface which defines all data access methods in a module. Each module of the application software should have this interface to isolate the data layer from the business layer. The business layer and the data layer are coupled through the interface. It can reduce the interaction between the layers and is preferred by software modification.
DAO implement: It is the implement class for DAO interface, which calls the methods of the Manage Hibernate class to create Hibernate Session Factory object and to achieve the CRUD (Create, Retrieve, Update, Delete) for data access.
Manage Hibernate: It is a tool class for the Hibernate management. It contacts Hibernate directly. It provides methods to initialize Hibernate and creates Hibernate SessionFactory object according to the file “hibernate.cfg.xml” and ORM mapping files. It also provides methods to create Hibernate Session object, open Session, close Session and so on. Meanwhile, in order to recover data easily, log mechanism for the data layer should be provided and can be achieved by using Hibernate3 Log4J.
Hibernate3: It is Hibernate3 framework which is used to encapsulate the database. Each Session Factory object corresponds to a database and each Session object corresponds to a database access session. The Hibernate Session objects provide all kinds of methods for database access.
Database: It is a relation database. The MySQL 5.0 that is used by author is an open resource relation database.
Ⅳ. SOME TECHNOLOGICAL PROBLEMS IN DESIGNING
For security, each request from JSP must be acted as a Action request which is received by Struts2 Filter Dispatcher in order to avoid hyperlink between pages.
Hibernate Session Factory object is used to connect database and to create connection pool. Therefore, it consumes more system resources. It is a heavyweight and thread secure object. It should be shared by multiple threads. In order to save memory and to improve operation efficiency, static way should be adopted to use this heavyweight object.
Hibernate Session object is corresponding to a data access session. It is a lightweight object. It should be created and destroyed frequently in application software.
In order to ensure the integrity of the data, the operations collection of database access must be executed completely, so that Hibernate JTA (Java Transaction API) must be used to realize the session transaction.
Session is an insecure thread. To prevent conflicts, it is best for each thread to create one Session object in application software, i.e. each session request should have its own Session object instance. A better way is to use the Thread Local class to bind its corresponding Session object respectively.
The key code of binding Session objects:
private static ThreadLocal<Session> threLocal = new
ThreLocal<Session>();
public static Session currentSession()
{
Session cSession = (Session)threLocal.get();
if(cSession == null)
{
cSession = sessionFactory.openSession();
threLocal.set(cSession);
}
return (Session) threLocal.get();
}
public static void closeSession()
{
Session cSession = (Session)threLocal.get();
if (cSession != null)
{
cSession.close();
threLocal.set(null);
}
}
Ⅴ. S CONCLUSIONS
In this software architecture, the presentation layer uses Struts2 middleware. It receives client data, transfers the client requests to the related business module. Meanwhile, it demonstrates the responding page.
The data layer maps object/relation in the relation database by using Hibernate3 middleware. Static way should be adopted to use the heavyweight Hibernate SessionFactory object for saving the system resources, ThreadLocal class should be used to bind the lightweight Hibernate Session object to ensure the security of the thread.
Coupling through the interfaces of different layers can minimize the interaction the layers. It helps to change and expand the application software.
In order to use and manage Hibernate consistently, it is necessary to design a ManageHibernate class, which provides services for DAO.
From the front stage JSP to the back stage Hibernate, POJO is always used as transfer parameter between layers and operated as data object.
POJO of presentation layer encapsulating client data can be the same class as POJO of data layer making ORM mapping.
  全套毕业设计论文现成成品资料请咨询微信号:biyezuopin QQ:2922748026     返回首页 如转载请注明来源于www.biyezuopin.vip  

                 

打印本页 | 关闭窗口
本类最新文章
The Honest Guide Sonar Target Cla Process Planning
Research on the Sustainable Land UniCycle: An And
| 关于我们 | 友情链接 | 毕业设计招聘 |

Email:biyeshejiba@163.com 微信号:biyezuopin QQ:2922748026  
本站毕业设计毕业论文资料均属原创者所有,仅供学习交流之用,请勿转载并做其他非法用途.如有侵犯您的版权有损您的利益,请联系我们会立即改正或删除有关内容!