Should I do JSPX instead of JSP?

Using JDeveloper , I started developing a set of web pages for a project at work. Since I did not know much about JDev at the time, I switched to Oracle to follow some tutorials. JDev tutorials recommended JSPX instead of JSP , but didn't really explain why. Are you developing JSPX pages? Why did you decide to do this? What are the advantages / disadvantages of switching to a JSPX route?

+47
jsp jspx
Aug 26 '08 at 14:41
source share
8 answers

The main difference is that it is easier to work with a JSPX file (officially called a "JSP document") because the requirement for a well-formed XML may allow your editor to identify more typo and syntax errors as you type.

However, there are also disadvantages. For example, a well-formed XML should avoid things like less characters, so your file may contain content, for example:

<script type="text/javascript"> if (number &lt; 0) { 

The XML syntax can also be more verbose.

+48
Aug 26 '08 at 15:59
source share

JSPX has a few inconveniences on top of my head:

  • It is difficult to generate some types of dynamic content; especially generating an HTML tag with optional attributes (i.e., or depending on state). The standard JSP tags that should solve this problem did not work properly the day I started making JSPX.
  • No more and nbsp; :-p
  • You really want to put all your Javascript in separate files (or use CDATA sections, etc.). IMHO, you should still use jQuery, so you don't need to have onclick attributes, etc.
  • Tools may not work properly; your development environment may not support anything higher than a simple JSP.
  • In Tomcat 6.x, at least the version of / config that I tried, the generated output has no formatting; just a little annoyance though

On the other hand:

  • It makes you write the right XML, which can be easily manipulated than the JSP
  • Tools can perform instant checks, catch errors earlier
  • Simplified syntax in my humble opinion
+22
Oct 21 '08 at 23:02
source share

A completely different line of reasoning why you should use jspx instead of jsp:

JSPX and EL make the inclusion of javascript and embedded java codes much more complex and much less natural than jsp. EL is a language specifically designed for presentation logic.

All this prompts you to a clearer separation of user interface visualization and other logic. The drawback of the many inline code on the JSP (X) page is that it is almost impossible to easily test, while the practice of this separation of problems makes most of your logic completely block-testable.

+11
Nov 19 '09 at 7:25
source share

Hi, JDeveloper Developer!

I have been working with JSPX pages for over two years, and I have never had a problem with JSPX versus JSP. The choice for me to go with JSPX was clearly forced, since I use JHeadstart to automatically create ADF Faces pages, and by default, JHeadstart generates everything in JSPX.

JSPX indicates that the document should be a well-formed XML document. This allows the material to correctly and efficiently analyze it. I heard the developers say that this helps your pages to be more of a "future proof" opposite to JSP.

+6
Aug 26 '08 at 14:50
source share

As stated in the official Spring 3.1 documentation

"Spring provides some turnkey solutions for JSP and JSTL views."

You also need to consider JSPX striving to produce pure XML-compatible output. Therefore, if your goal is HTML5 (which can be XML compatible but increase complexity, see My comments), you get some pain to achieve your goal if you use the Eclipse IDE ... If your goal is to create XHTML, then go to JSPX and JDeveloper will support you ...

In one of our projects, we made POC with both JSP and JSPX, and did PROS and CONS, and my personal recommendation was to use JSP, because we found it to be much less restrictive and natural for creating HTML5 non-XML -a way that is also less restrictive and more compact syntax. We prefer to choose something less restrictive and add recommendations of "best practices", such as "do not put java scripts" inside jsp files. (BTW JSPX also allows you to host scripts using jsp: scriplet instead of <% ...%>)

+6
Aug 09 2018-12-12T00:
source share

@ Matthew-
ADF! The application I'm working in now has 90% of the presentation level created by the PL / SQL module. I started working on several new screens and wanted to explore other options that could fit into our architecture, without a significant burden of training (increasing the complexity of the system / disrupting the intelligent models of system developers) for other developers on the team. So ADF is how I came across JSPX.

I also saw the "future evidence" of the observation ... but I did not know how good it was.

+2
Aug 26 '08 at 15:07
source share

JSPX is also the recommended viewing technology in the Spring MVC / Spring web stream.

+1
Mar 10 '10 at 18:09
source share

Also, another problem I found with JSPX is when you want to use scripts. I agree that clean code is generally good, and Java logic in JSP is usually bad, but there are certain cases when you want to use the utility function to return a string value or something where TagLib or model (request attributes ) will be redundant.

What are all the scripting thoughts in JSP?

0
May 12 '14 at 8:55
source share



All Articles