Methods of using Hibernate by Tile.

xiaoxiao2021-03-06  20

Since the start of learning JSP, it has been affected by the MVC2 mode. May be a chance to write the code before. I rarely do something. So always feel the first choice for the development of the JSP page. Because this can be implemented, the code is separated from the page. And because of personal work, it is still in theory >> Practice. Therefore, special first recommended standardization in the project. Everything is MVC. When you learn TILE this time. I feel that this is not entirely simple in the Action preparation data, and then launches a JSP development method. It seems that the TILE's Control has destroyed the push mode. With the Control function, you can pull out the data in the JSP page. For example, a UserList operation. If you do not use TILE, you may read the data in the action and then encapsulate to the ActionForm is displayed by the JSP page. After using TILES, you can use a Tiles Control to read the required data from the database in the database in JSP. This is more flexible, don't anything from ActionForm. What should I do if there is no corresponding data in the actionform when adjusting the page adjustment? Although Actionform's design is recommended to use a coarse granular design, how to thicken can not change all business changes. Perhaps it is a small project now, so pay special attention to development efficiency. In order to facilitate flexible and flexible to pull out the required data. And not to write too much script or tiles control, so define a label running HQL. In this way, you can run HQL directly on the page, what cached, displaced, performance, and SQL have given Hibernate to play the role of Hibernate. The label is designed using the similar ways in Struts as follows: --- Run a HQL - Resize: // Directly use script variables defined by <% = Test.Size ()%>
// Using Struts Tags defined pageContext properties.
- loading a PO --- enumeration name: <% = test . GetenumName ()%> This will be convenient to read data from the database in the JSP page. It is also to meet the development habits of those habits to write SQL inquiry in JSP. Although there is a lot of bad places. But for the current project, this is the best way.

转载请注明原文地址:https://www.9cbs.com/read-40371.html

New Post(0)