Edit the JSPX file under Intellij IDEA

xiaoxiao2021-03-06  46

JSPX is an important feature in JSP 2.0. JSPX is actually written in JSP in XML syntax. We know the format of JSP, in which an important feature is to include "<%" declare, JSP files typically appear as HTML code after server-side processing, although JSP usual purpose is to process web pages, but JSP code is presented Not the HTML or XML format we want, the code is very confusing, which is why JSPX appears.

JSPX fully symbol XML syntax specification, this standardization will bring a lot of benefits, and our coding will be much convenient, such as XML's convenient code formatting, easy to edit. Let's take a look at the traditional JSP code and the current JSPX code: (JSPX editing requires the IDEA 5.0 version)

JSP code:

Demo.JSP

<% @ Page ContentType = "text / html; charset = GB2312"%>

<% @ Page Import = "java.util. *"%>

<% @ Taglib Uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%>

my demo jsp </ title></p> <p></ hEAD></p> <p><body></p> <p><%</p> <p>Date now = new date ();</p> <p>Out.println (now.toString ());</p> <p>%></p> <p></ body></p> <p></ html></p> <p>Demo.jspx</p> <p><JSP: root Xmlns: jsp = "http://java.sun.com/jsp/page"</p> <p>XMLns = "http://www.w3.org/1999/xhtml"</p> <p>XMLns: c = "http://java.sun.com/jsp/jstl/core" Version = "1.2"></p> <p><JSP: Directive.page ContentType = "Text / HTML" PageEncoding = "GB2312" /></p> <p><jsp: Directive.page Import = "java.util.date" /></p> <p><html></p> <p><HEAD></p> <p><title> my demo jspx </ title></p> <p></ hEAD></p> <p><body></p> <p><JSP: Scriptlet></p> <p>Date now = new date ();</p> <p>Out.println (now.toString ());</p> <p></ jsp: Scriptlet></p> <p></ body></p> <p></ html></p> <p></ jsp: root></p> <p>In JSPX, we can't see the "<%" and "%>" symbols we are familiar with, which should be completely incompatible for these two symbols and XML format, if you want to use JSP Scriptle, you can use "<JSP : Scriptlet> "Operation. The original Taglib declaration is now converted to XML namespace (Namespace), and Taglib is also very convenient. If it is a development web page, JSPX is completely HTML code, just joined JSP: root declaration before the page. JSPX writing is very convenient, let's introduce how to edit the JSPX file in the actual development. 1 Use Dreamweaver to edit JSPX: Here we use JSPX to treat it as HTML, Dreamweaver defaults to edit the file for the JSPX suffix name, we only need to turn the% Dreamweaver_Home% / Configuration / DocumentTypes / MMDocumentTypes.xml file, in ID " Adding JSPX in the "WinfileExtension" property value of HTML ", when we open the JSPX file, simply use the ordinary HTML file editing, using the excellent visual interface design of Dreamweaver, this editing method is more edited. The JSP file is more convenient.</p> <p>2 There is no graphical editing environment in the Intellij IDEA environment, but the editing function of the code is not weak. The IDEA provides a JSPX file template by default. If Web Module's changes, you can create a JSPX file. Intellij IDEA can edit JSPX as a normal HTML file according to HTML namespace, including prompts, CSS support, etc., and provide this code prompt of this named space, including XML's Schema and Java Taglib two ways, both of which are complete It can be integrated in the JSPX file, because JSPX is a standard XML file, formatted is possible. For JSP's default namespace, IDEA provides more support, such as automatic import import, JSP scriptlet code, etc., you will find these features when editing.</p> <p>Summary: JSPX is indeed a gospel to the development, using XML syntax to write JSP files, which makes the code more standardized, standardized code is also the basis of graphical operation, plus namespace support for various Taglib, believe The editing JSP is very useful for future graphical ways.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-54639.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="54639" 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.067</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 = 'pJ5XkNEwDCBGZqINcs_2B2y75RGIt3Osi2XIOIInDt9XfU4yxKcooC207x4sYMwQ4_2FVml7NkcUoo6EkPPgnKdTOA_3D_3D'; 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>