<p>Using <a href="http://www.oracle.com/technology/products/jdev" rel="noreferrer">JDeveloper</a>, I started developing a set of web pages for a project at work. Since I didn't know much about JDev at the time, I ran over to Oracle to follow some tutorials. The JDev tutorials recommended doing <a href="http://www.fileinfo.net/extension/jspx" rel="noreferrer">JSPX</a> instead of <a href="https://java.sun.com/products/jsp" rel="noreferrer">JSP</a>, but didn't really explain why. Are you developing JSPX pages? Why did you decide to do so? What are the pros/cons of going the JSPX route?  </p>

[{'answer_id': 28250, 'author': 'Matthew Ruston', 'author_id': 506, 'author_profile': 'https://Stackoverflow.com/users/506', 'pm_score': 3, 'selected': False, 'text': "<p>Hello fellow JDeveloper developer!</p>\n\n<p>I have been working with JSPX pages for over two years and I never had any problems with them being JSPX opposed to JSP. The choice for me to go with JSPX was kinda forced since I use JHeadstart to automatically generate ADF Faces pages and by default, JHeadstart generates everything in JSPX.</p>\n\n<p>JSPX specifies that the document has to be a well-formed XML document. This allows stuff to properly and efficiently parse it. I have heard developers say that this helps your pages be more 'future proof' opposed to JSP.</p>\n"}, {'answer_id': 28290, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>@Matthew-<br>\nADF! The application I\'m presently working on has 90% of the presentation layer generated by mod PL/SQL. I started working on a few new screens and wanted to investigate other options that might fit into our architecture, without being to much of a learning burden (increasing the complexity of the system/crashing developer\'s mental models of the system) on fellow developers on the team. So ADF is how I came across JSPX, too.</p>\n\n<p>I saw a "future proof" observation as well...but didn\'t know how well founded that was.</p>\n'}, {'answer_id': 28472, 'author': 'Peter Hilton', 'author_id': 2670, 'author_profile': 'https://Stackoverflow.com/users/2670', 'pm_score': 7, 'selected': True, 'text': '<p>The main difference is that a JSPX file (officially called a \'JSP document\') may be easier to work with because the requirement for well-formed XML may allow your editor to identify more typos and syntax errors as you type.</p>\n\n<p>However, there are also disadvantages. For example, well-formed XML must escape things like less-than signs, so your file could end up with content like:</p>\n\n<pre><code>&lt;script type="text/javascript"&gt;\n   if (number &amp;lt; 0) {\n</code></pre>\n\n<p>The XML syntax may also be more verbose.</p>\n'}, {'answer_id': 223873, 'author': 'alex', 'author_id': 26787, 'author_profile': 'https://Stackoverflow.com/users/26787', 'pm_score': 5, 'selected': False, 'text': "<p>JSPX has a few inconvenients, on top of my head:</p>\n\n<ol>\n<li>It's hard to generate some kinds of dynamic content; esp. generating an HTML tag with optional attributes (i.e.  or  depending on a condition). The standard JSP tags which should solve this problem didn't work properly back in the day I started doing JSPX.</li>\n<li>No more &amp; nbsp; :-p</li>\n<li>You'll really want to put all your Javascript in separate files (or use CDATA sections, etc.). IMHO, you should be using jQuery anyway, so you really don't need to have onclick, etc. attributes...</li>\n<li>Tools might not work properly; maybe your IDE does not support anything above plain JSP.</li>\n<li>On Tomcat 6.x, at least the versions/config I tried, the generated output does not have any formatting; just a small annoyance, though</li>\n</ol>\n\n<p>On the other hand:</p>\n\n<ol>\n<li>It forces you to write correct XML, which can be manipulated more easily than JSP</li>\n<li>Tools might perform instant validation, catching mistakes sooner</li>\n<li>Simpler syntax, in my humble opinion</li>\n</ol>\n"}, {'answer_id': 1761500, 'author': 'krosenvold', 'author_id': 23691, 'author_profile': 'https://Stackoverflow.com/users/23691', 'pm_score': 4, 'selected': False, 'text': "<p>A totally different line of reasoning why you should use jspx instead of jsp:</p>\n\n<p>JSPX and EL makes including javascript and embedded java codes much harder and much less natural to do than jsp. EL is a language specifically tailored for presentation logic.</p>\n\n<p>All this pushes you towards a cleaner separation of UI rendering and other logic. The disadvantage of lots of embedded code within a JSP(X) page is that it's virtually impossible to test easily, whereas practicing this separation of concerns makes most of your logic fully \nunit-testable.</p>\n"}, {'answer_id': 2419369, 'author': 'Hendy Irawan', 'author_id': 122441, 'author_profile': 'https://Stackoverflow.com/users/122441', 'pm_score': 2, 'selected': False, 'text': '<p>JSPX is also the recommended view technology in Spring MVC / Spring Web Flow.</p>\n'}, {'answer_id': 11884615, 'author': 'A. Masson', 'author_id': 704681, 'author_profile': 'https://Stackoverflow.com/users/704681', 'pm_score': 3, 'selected': False, 'text': '<p>As stated in Spring 3.1 official documentation </p>\n\n<blockquote>\n  <p>"Spring provides a couple of out-of-the-box solutions for JSP and JSTL\n  views."</p>\n</blockquote>\n\n<p>Also you have to think about the fact that JSPX aims to produce pure XML compliant output. So if your target is HTML5 (which can be XML compliant but increase complexity see my next comments) you got some pain to achieve your goal if you are using Eclipse IDE... If your goal is to produce XHTML then go for JSPX and JDeveloper will support you...</p>\n\n<p>In one of our cie projects we made a POC with both JSP and JSPX and made PROS and CONS and my personal recommandation was to use JSP because we found it much less restrictive and natural to produce HTML5 in a non XML way which is also less restrictive and more compact syntax. We prefer to pick something less restrictive and add "best practices" recommandations like "do not put java scriptlets" inside jsp files. (BTW JSPX also allows you to put scriplets with jsp:scriplet instead of &lt;% ... %>)</p>\n'}, {'answer_id': 23604783, 'author': 'Thomas Beauvais', 'author_id': 2606716, 'author_profile': 'https://Stackoverflow.com/users/2606716', 'pm_score': 0, 'selected': False, 'text': "<p>Also, another problem I have found with JSPX is when you want to use scriptlets.  I agree that clean code is generally good and Java logic in the JSP is generally bad but there are certain instances where you want to use a utility function to return a string value or something where a TagLib or the model (request attributes) would be overkill.</p>\n\n<p>What are everyone's thoughts regarding scriptlets in JSP?</p>\n"}]
['https://Stackoverflow.com/questions/28235', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']