Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the problems that cannot be solved by struts structure in J2ee?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about the problems that cannot be solved by the struts structure in J2ee. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

First: the problem of users logging in repeatedly

I have considered two solutions to this problem:

1: you can use session to implement. The specific implementation may use session's listening listener. I think this can be achieved (refer to this article that all listening events must be monitored in session). We can save all logged-in user names in an ArrayList, so that when the user logs in, we can first determine whether this user name exists in ArrayList. If if exists, it means that we have logged in, while else has not yet logged in. Storing the user name in ArrayList, according to this way of thinking, seems to solve the problem of repeated login, but there is still a problem, that is, if the user logs out abnormally and the session is not destroyed, then the user cannot log in within the time of session-timeout (the time when the system destroys the session). Please refer to the session explanation. It is mentioned in the session explanation that you need to call HttpSession.invalidate () to destroy the session. Or the time interval from the last session id sent by the client exceeds the timeout setting of session, and the session cannot be deleted when the browser is closed. From this point of view, if the session still exists after the user closes the browser, even if the user does not log in, then the user will have to wait a long time to log in. How to solve this problem?

2: database temporary tables can be used to solve the problem, but this method requires that the transaction session of the database connection be maintained for a long time, because the temporary table is destroyed at the end of the transaction session. How can the mvc structure of struts keep a session or transaction not destroyed during the user's operating system? Is the Jianli of the database transaction session built when connecting to the database? Is it all right to keep the database connected?

Second: the problem of data modification

In our system, the modification of data is to find a record first, then display it in jsp, modify it and then submit it, but this can not prevent multiple people from modifying this data at the same time. We can use row lock method to lock this record, that is, select for update way to lock this record, but the premise is to extract data and modify data as the same transaction to deal with, but in the struts structure is now used to extract data and modify data independently, how can extract data and modify data as the same transaction? Is it all right to keep a connection open just like a temporary watch? What should be done?

Thank you for reading! This is the end of this article on "what are the problems that cannot be solved by the struts structure in J2ee?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report