When writing a web application, you will often encounter some repetitive work, for example: The user said that I want to put a column on the table, displayed in the first column. Wait similar to demand, we may look like Things, but have you found that we have been constantly modifying your code, to adapt to users' demand changes, why we can't simplify these operations, use enhanced controls to simplify us to modify the operation.
If the user has changed, it is mainly concentrated on the VIEW layer, and for the Controller layer and the Model layer has not changed, then we will modify the code, just modify the html tag position in the page, as long as the HTML control name does not change, then submit to When the server is connected, the page function will not be wrong. So we have to modify, mainly concentrated in the page HTML control tag position, and the JavaScript control page HTML control store information is controlled. As long as we can manage the page HTML controls and JavaScript have to operate, we can change the location on any changes to the page.
I want to do some common controls to adapt to the changes in the user's page demand. (Temporarily discussing the page display change, for functionality, no discussion)
I will give a common example, you have to change the change. (It seems very common, it is not easy to achieve industrial development!) Use JavaScript (JSP / ASP) SQL Server2000 implementation.
-------------------------------------------------- - - --------------------------- - Name - Gender - Age - Height ---------------------------------------------------------------- --------------- 张三 - Male - 30 - 170 - ------------------------- - - 李 四 - Male - 45 - 180 - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------
Increase Delete Save ----------------------------------------------------------------------------- ---- Note: Add: Click the button to increase the space line, can be freely filld by the user. Delete: Click on a line in the table, click the Delete button, you can delete this line information. Save: Click the save button, you can submit Database users have all operations.
User demand changes: 1. I want to put the age before. (This is easy to implement, just change the query order.) 2. I want an only 10 line data (you can use paging control) This is also easy to implement) 3. I want to click on them, add a right-click menu, and can increase, delete, save functions (this is a must, develop a right-click menu control) 4. If the user said, I don't want this Play mode, I want to move the form of form (right-click, you can move) (this time your change will be huge, if the project is basically molded, then all the modules will change, it is simply a nightmare But the truth is this!)
Explanation: The user has to change, mainly in the page view layer, no change for the Controller layer and the Model layer, when modifying the code, as long as the HTML tag position in the (JSP / ASP) page is modified, as long as the HTML control name If you do not change, then the submitted to the server is time, the page function is not an error. So we have to modify, mainly in the page of the HTML control tag position, and the JavaScript control page HTML control store information is controlled. Just We can manage HTML controls and JavaScript on page, we can change the location on any change.
For the top three demand changes, it is estimated that most people have experienced, and the change is also very normal, but the fourth demand changes, it is estimated that there are very few programmers to endure, this change will be devastated. But the reality is really common. It is similar to what I often meet. I have the focus of the problem mainly focus on the VIEW layer in the MVC mode, which is not flexible. So we try to make the View layer flexible.
Based on the component development mode to refine the VIEW layer in the MVC. First, develop general application common controls, such as: table, mobile form (requires a large number of changes, highly flexible) table control: requirements can be similar Delphi DBGRIDE features to increase the display control function.
The above page is displayed, you can use (JSP / ASP) to query the data from the database, then put it into the table control. Table control analysis data is displayed. For the top three demand changes, modify the table control availability, you can achieve changes in demand Objective. For the fourth demand change, modify the control type, turn the table control, replace the mobile form control. This will adapt to the user's main job for the page display requirements, the programmer has main work, is on the development versatility of the control .
I have to publish the 9CBS forum. Many people say that using JavaScript development controls will be very difficult, and JavaScript browser support is also different, so writing universal controls, the workload will be large, I agree to this problem, I agree , A way of transfers, is to develop a set of management HTML certificates using JavaBean, developing some simple verification controls, this idea looks very much Struts, but I want to solve the problem, just struts realize one aspect, I Just want to refine the View layer, for example: using JavaBean to develop a table control independently, or use this control in Struts, so that this control not only refines the View layer, but also reduces the View layer coupling.