Struts a little idea

xiaoxiao2021-03-06  19

I started learning Struts more than a year, but I have not used it to develop projects. I feel very good after doing some small Demo. But the recent company uses Hibernate Struts framework development. When I go to join, the basic framework has been built. I feel that the development framework is very irregular, and there is a script in many pages. Using HQL from querying the database in a lot of places. Why do they do this? I feel very strange, and later managers told me that because the project is relatively small, some places are more flexible.

Since we are divided into operation according to the function module (I am not used to this way). So I can develop according to my own way, using form to encapsulate all the data you need to display. Basically, it is developed in accordance with MVC2. Use the DAO to call the Hibernate Operating Database in Action. Pack PO directly into the ACTIONFORM, and read the data that you want to display on the page to read it in an actionform. In the form of form processing, ActionFormCopy is used to the corresponding PO, and then it to the DAO operation. But later due to the change of the page. It is found that the information encapsulated in the Actionform is not enough. This often modifies the speed of Actionform to develop. Every revision needs to recompile, release, although it is very convenient to operate in IDE, but it feels quite a waste of time. If you modify the field of the database to modify the PO and ActionForm, it is too much trouble. Later I wanted to take ActionForm and Po together. If so, you have to let Po inherit an actionform, so it is mixed with some verification logic, and it feels not very good. And this will be very different from the previous development.

I think if Actionform does not need to inherit a unified actionform, or change the actionform to interface, such as: If the "com.cms.jxdc.model.tinvlistform" does not implement the Actionform interface, he treats him as a simple Vo, and is used as the PO in Hibernate. This will avoid repeating some substantially the same beans. Perhaps this is not strictly designed in the big project, but it is not possible for the development cycle and human resources.

In the project, I also used Struts Tiles. I feel that I will increase it. It is still quite trouble when you use it, feel that there is no need to get it. For example: in a list.jsp page:

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

New Post(0)