1. Field of Invention
The present invention relates to a method for controlling a web page operation, and more particularly to a method for preventing the same web page from being operated by more than one people at the same time in browser/server (B/S) architecture.
2. Related Art
Browser/server (B/S) architecture is a system architecture constituted by a browser and a server, which is modified or improved based on client/server (C/S) architecture along with the emergence and development of the Internet technology. In the C/S architecture, a user interface is realized through a World Wide Web (WWW) browser, a minor portion of business logic is implemented by a browser, and the major portion of business logic is implemented by a server, forming a 3-tier architecture. Thus, the load on the user computer, the cost and workload for system maintenance and upgrade, as well as the total cost of ownership (TCO) are greatly reduced.
In the current C/S architecture, mechanisms for preventing the same document or file from being operated by more than one user at the same time have already been developed, such as Microsoft Word and Excel. When more than one user opens the same file, all users except for the user that opens the file at the earliest time will be notified that the file is currently in a read-only status. Such a mechanism can conveniently notify the users and solve the problem of inconsistent file contents when the file is saved after modification. However, at present, such mechanisms cannot be found under the B/S architecture. When more than one user processes the same data presented via browsers, a user may input many data, but find that other users have also made modifications to the data when the user submits the data, and thus fails to save the data. Otherwise, the data modified by other users will be overwritten; as a result, the data integrity cannot be maintained.
Accordingly, the present invention is a method for controlling a web page operation in browser/server (B/S) architecture, in which when a web page in a server is operated by a first browser, the server checks a status record table after a second browser requests for operating the web page, and responds whether the second browser has an operation control right to the web page or not according to a check result.
Therefore, in the method for controlling a web page operation in browser/server (B/S) architecture of the present invention, when a web page in a server is operated by a first browser, the server performs a check after a second browser requests for operating the web page. The method comprises: establishing a status record table for recording a usage status of the web page by the server; checking the usage status of the web page in the status record table by the server after receiving a request for operating the web page from the second browser; accepting the request and submitting an operation control right of the web page to the second browser by the server if the usage status of the web page is idle; sending a check message to the first browser by the server to check whether the first browser is still using the web page or not if the usage status of the web page is operating; and rejecting the request of the second browser and transmitting the usage status of the web page to the second browser by the server if the first browser responds to the check message and the first browser is still using the web page.
Here, fields of the status record table comprise a web page name, a web page path, an update time, a usage status, and a user name. The web page name is used for storing a name of the web page. The web page path is used for storing a path of the web page. The update time is used for storing time when the web page is operated. The usage status is used for storing a current usage status of the web page. The user name is used for storing a name of a browser operating the web page.
In addition, after the step of sending the check message to the first browser by the server, the method further comprises: updating a record of a usage status of the web page of the second browser in the status record table and submitting the operation control right of the web page to the second browser if the first browser does not respond to the check message.
Moreover, after the step of sending the check message to the first browser by the server, the method further comprises: updating a record of a usage status of the web page of the second browser in the status record table and submitting the operation control right of the web page to the second browser if the first browser responds to the check message and the first browser is not using the web page.
The present invention provides a method for controlling a web page operation in B/S architecture, which enables a sever to control requests for operating the web page from different browsers by utilizing the status record table corresponding to the web page, thus maintaining the data integrity of the web page.
The present invention will become more fully understood from the detailed description given herein below for illustration only, and thus are not limitative of the present invention, and wherein:
In Step S100, a server establishes a status record table for recording a usage status of the web page.
In Step S200, the server checks the usage status of the web page in the status record table after receiving a request for operating the web page from a second browser.
In Step S300, if the usage status of the web page is idle, the server accepts the request and submits an operation control right of the web page to the second browser.
In Step S400, if the usage status of the web page is operating, the server sends a check message to the first browser to check whether the first browser is still using the web page or not.
In Step S500, if the first browser responds to the check message and the first browser is still using the web page, the server rejects the request of the second browser and transmits the usage status of the web page to the second browser.
In addition, Table 1 is a status record table according to an embodiment of the present invention. Here, fields of the status record table may comprise a web page name, a web page path, an update time, a usage status, and a user name. The web page name is used for storing a name of the web page. The web page path is used for storing a path of the web page. The update time is used for storing time when the web page is operated. The usage status is used for storing a current usage status of the web page. The user name is used for storing a name of a browser operating the web page.
Herein, the fields of the status record table may be set and adjusted as required.
In Step S510, if the first browser does not respond to the check message, a record of a usage status of the web page of the second browser in the status record table is updated and the operation control right of the web page is submitted to the second browser.
In Step S520, if the first browser responds to the check message and the first browser is not using the web page, a record of a usage status of the web page of the second browser in the status record table is updated and the operation control right of the web page is submitted to the second browser.