HTML, SWING is also XML, Java client tool selection? (four)

zhaozj2021-02-17  46

Client application based on XML / XSLT

Here, we assume that you have a basic understanding of XML, I will focus on discussing the development of their front-end applications. One main feature developed with XML-related user interface is that the content and expression methods are not interfere. Simply, the data is saved as an XML document, and no longer responsible for the use and display of data. Select in HTML, WML, XHTML, and other expression forms based on the status table (XSLT) of the data format and the output mode on the web page. A data expression form. By maintaining relative independence between the layers, each layer processes the respective tasks, the advantage of this method is very obvious.

Although XML provides a good data release mode, you can generate different expression modes, which still cannot solve all problems. The XML is worthy of the truth that developers focus on the processing of data, and allows designers and artists to deal with data. The application saves the generated XML file in memory or stored on the disk, to obtain the specified expression type, such as HTML, can convert the content by the appropriate XSLT type table, which can convert XML documents to HTML documents . The contents of the type table and the determination document should be distributed to templates on the web page. It also converts data, performs traditional commands and loops to process data, making decisions, so it may become very complicated.

One of the advantages of the type table is that if you want to access the same application from a mobile phone, all the work you need is to create a new WML type table. In theory, all other parts of this application do not need to be changed, which makes the server-side programming work very efficient. Implementing a front-end application using XML will make some tasks simple, because the data displayed and the code that handles these data does not need to be changed. Development teams in developing applications can work independently to accelerate the development process.

However, I have eaten in the development of XML-based front-end applications, and the two most important disadvantages are the lack of tools and processing speeds for the generation of XML and type development, the first factor for those who use Dreamweaver and FrontPage and other visual HTML development tools have greater impact on developers who create HTML web pages. As far as I personally, I still like to use Dreamweaver, but I can't get what is fun from writing HTML code in the text editor. After all, it is already a very simple XSLT type table that is a very simple XSLT type table that converts XML documents to HTML:

<xsl: value-of select = "title" /> </ title> </ head> <body> <xsl: Apply-Templates /> </ body> </ html> </ Xsl: template> <xsl: template match = "title"> <h1> <xsl: Apply-Templates /> </ h1> </ xsl: template> </ xsl: stylesheet> If the selected XSL type table If appropriate, the above code will generate the HTML code as shown below:</p> <p><Html> <head> <title> my first page </ title> </ head> <body> <h1> hello, world </ h1> </ body> </ html></p> <p>We will find that the above code is not the same as the code we get with the HTML development tool. Unfortunately, we must edit it with manual way, and then process it in a tool that can generate an HTML document, and then open the generated document in the browser. If you only change the size of the font, then you don't have to do this.</p> <p>The second problem is to do all tasks for many times at runtime. If the data format is not XML, you also need to generate an XML document, and the HTML code can be generated after the Type Table is converted. The speed and simpleness are not based on the advantages of XML-based front-end applications compared to the memory cache in the servlet or JSP application.</p> <p>All in all, if you need to dynamically generate different layouts and forms of expression form, you need to use XML. If the expression of expression needs to change frequently or is very flexible, you should let the designer will redesign the new type of type. What needs to be remembered is that the designer as long as the XML and XSLT are all right.</p> <p>Another XML-based UI occasion is that the information you need to process is an XML document, not a Java object or relational database. XML is a new technology in the future, however, currently using JSP development front-end applications is not more convenient, especially HTML is the only front-end development tool. Some famous design modes such as JavaBeans and JSP identity libraries can make the contents and expressions of the data. With the automatic use of the tools for editing XML / XSLT, these technologies will be more simple and convenient.</p> <p>in conclusion</p> <p>Specifically to your own Java app, these three front-end technologies have their own advantages and disadvantages, and any technology cannot exceed the other two in all aspects. For specific applications, we must analyze the needs and users' expectations, and evaluate these three technologies. Here are some basic guidelines: use HTML / JSP:</p> <p>━━ Suitable for static content consisting of a large number of graphics and artwork.</p> <p>The interface of the front-end application is used for users of all platforms.</p> <p>━━ The internet connection used by the user is slow.</p> <p>━━ Hopefully build a single application of a single application.</p> <p>Use Java Swing:</p> <p>━ Suitable for creating a GUI with a built-in, related logic related to the interface.</p> <p>━━ 减 网络 网络 网络 网络 流,, 尽. 即..</p> <p>━━ If the user has a high quality and functionality of the interface.</p> <p>━━ If the functionality of the UI is more important than its beauty.</p> <p>Use XML / XSLT</p> <p>━━ Need to support many different and frequently changed forms.</p> <p>━ 数据 Data is XML format.</p> <p>━━ ━ 需要 needs personalization.</p> <p>━━ Plan a different way of access to wireless access.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-29487.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="29487" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.060</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'xNawkIgyClihMe4snvp8P3KcVbfu4_2Feb1vg9uXBVth3MuwHp27xVbmsokeGMJXar2GmAhDnGM4wvUSVa'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>