Java User Data Integrity front-end display (implementation), java User Data

Source: Internet
Author: User

Java User Data Integrity front-end display (implementation), java User Data


Collation
The previous article has already mentioned the general idea. This article mainly describes the implementation of the first idea in detail. For more information about the request process of user data integrity, see the previous article "front-end display of Java User Data Integrity (IDEA)".

Body
The front side also said that I am using the first solution here. The front end uses the progress bar component of Bootstrap to display the percentage. The back end reads the weight and calculates the information integrity, return the calculation result to the front end for display on the page. The solution is very simple. Let's take a look at the code below.
Front-end CSS

<link href="static/sc/css/bootstrap.min.css" rel="stylesheet">

JS
<Script src = "static/SC/js/jquery-1.9.1.js"> </script> <script src = "static/SC/js/bootstrap. min. js "> </script> <script language =" javascript "> $ (function () {// when loading a page, dynamically read the completeness of Personal Data $. ajax ({async: false, url: 'getinfodegree. do ', type: 'post', ype: 'json', data :{}, error: function (XmlHttpRequest, textStatus, errorThrown) {alert ("server error: "+ XmlHttpRequest. status + "" + XmlHttpRequest. statusText + '! ');}, Success: function (data) {if (! Data) return; if (data. flag = "true") {$ ("# showSpan" ).html (data. degree); $ ("# showBar" ).css ("width", data. degree); $ ("# showPercent" pai.html (data. degree);} else if (data. flag = "false") {$ ("# infodegree" pai.html (data. desc); return false ;}}}) ;}); </script>

DOM
<P style = "color: #666;"> Personal Data Integrity: <span id = "showSpan" style = "color: # ff9933; font-size: 20px; font-weight: bold; "> </span> </p> <div class =" progress-striped "style =" width: 210px; height: 15px; "> <span style =" white-space: pre "> </span> <div id =" showBar "class =" progress-bar-info "role =" progressbar "aria-valuenow =" 60 "aria- valuemin = "0" aria-valuemax = "100"> <span style = "white-space: pre "> </span> <span id =" showPercent "class =" sr-only "> </span> <span style =" white-space: pre "> </span> </div> <em id =" infodegree "> </em>

Background Java (partial code)
/*** Calculate data integrity by weight * @ param map * @ return */private String getInfoDegree (List <TScAcntProp> list) {int sum = 0; if (list. size ()> 0) {// traverse the weight configuration file and obtain the weight for (int I = 0; I <list. size (); I ++) {int degree = Integer. parseInt (CommonUtil. getProperty (list. get (I ). getPLabelName (); sum + = degree ;}// return the calculated weight: return sum + "% ";}

In the configuration file, the weight is stored in the configuration file, which is captured as an image.




Conclusion
It seems that the terminology of the famous man is actually not difficult, as long as you understand the ideas, the solution will jump on the paper, of course, it will involve some technical issues, there will be different solutions based on different needs. After the technology is done, the specific implementation will come to fruition. Finally, I would like to thank little Cui kids shoes for their great help.

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.