Java User Data integrity of the front-end display (thinking)

Source: Internet
Author: User



Order
Regular internet people will be very familiar with today's topic, how to say, user information, is when we register a website, need to fill in the registration of some personal information, these personal information will be encrypted processed and stored to different servers. So what is completeness? Obviously, completeness is the site list of entries, as well as the registrant fill in the information of the contrast of the entries, the user filled out a few, and a few did not fill out (here is only valid data). Through this completeness can let users at a glance, improve their user profile.

Background
Briefly speaking of the background, in recent days, the company's design department to mention a few new needs, of course, this is one of them (or not in this nonsense (*^__^*) hee). Just start the manager to find out if there is no open source components, can be used directly. After online research, it is found that there is no ready-made open source components, but there are a lot of simple implementation ideas. This article is a brief discussion of these ideas, the next article to write a detailed implementation.

Body
User data integrity of the front-end display problems, there are generally two ways to solve the problem, the first is to request a background server, find a user's information, according to the information of the query to judge, of course, plus the corresponding weight, this according to the company's needs, the specific weight of a property to set the corresponding. It is important to note that the sum of each attribute must be 100%. Otherwise, the integrity of the user data is not enough real.
The second solution is not to request a background server, directly on the page to find the user has filled out the information, of course, this idea will be affected by a number of factors. For example, the user's primary information is not all displayed on the page, or the page is loaded using the framework, the page needs to be displayed and the page to look for is not the same, this is also restricted.
So, the following is a detailed talk about these two scenarios.
programme I
The first thing you need to do is to determine the properties of the lookup, and the corresponding weights of the attributes, which, of course, need to be given by the design department. Considering the future changes, we can put it in a separate abstraction, put in the configuration file, if the weight needs to be modified later, this is also very convenient.
For the front-end page display, in fact, this has a lot of options, just see how the company requirements. I use the progress bar here, Bootstrap progress bar components, not only convenient and easy, but also beautiful. Simply say the implementation of the principle, through the request background server, the background server calculates the data integrity of the logged-in user, such as the result is 50% after the calculation, then the 50% returned to the front-end Ajax function. The Ajax functions of the front end change the display of the progress bar by setting the width of the Div and the style.
The front end said, then the background server, the background server through the search user information login, of course, may involve more than one table, and then query the user information corresponding to the weight, and match it, will match the weights to calculate, and the results are returned to the front end in Json form.

Scenario Two
The second scenario is simply to find the user information that is loaded into the page, then read the weights of each information attribute and calculate the completeness of the information, eventually displaying the progress bar by changing the width and style of the Div.
Obviously, this method is simple, and does not need to request the background server, however, this method has a great limitation, that is, if the page does not display all the information properties, the information integrity of the calculation is to request the server. There is also if the front-end with a frame-loaded local page, then the display of User Information page and the display of information integrity of the page is not in a piece, then can not be found, which is also a big limitation.

My plan
By comparing the two scenarios above, and the characteristics of the existing system, I chose the first option, using a flexible way to set the weights of the properties and get the weights by reading the configuration file. Then, the front end is using the Bootstrap progress bar component.

Conclusion
Many times, we are thinking about how convenient, how to do easy, who do not know, these seemingly convenient components are actually a double-edged sword, although we use, the function also realized, but its principle you still do not know, you can only rely on his components. So, in the use of these open source components, we also need to ask more, in the end he is how to achieve, if it is me, I should how to achieve.
Of course, if there is no ready-made components, then we have to go to write their own, in fact, this is a good thing, although in a way a bit of trouble, but understand the principle, it is much simpler.
Well, the theory says a whole lot, and the withered is dead. The next article will come true ...

Java User Data integrity of the front-end display (thinking)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.