Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Disadvantages of JSTL

Following are some disadvantages of JSTL.

Disadvantage: Overhead

Both JSP scriptlet and JSTL code are translated to a Java servlet for execution. Because JSP scriptlet code is really just Java embedded in JSP files, there is relatively little overhead in the scriptlet code that is generated. This is not the case with tag libraries such as JSTL. Large JSP files that make use of JSTL will generate a great deal of overhead code. This means that more server-processing power is required to run JSTL-based sites than pure JSP scriptlet sites.

Another disadvantage of this overhead is that the size of a Java class is limited. Large complex JSP pages that make extensive use of JSTL and other tag libraries can quickly exceed this class-size limitation. If you run into this limitation, you will need to split your JSP page into multiple files.

Disadvantage: Not as Extensive as JSP Scriptlet

JSP scriptlet code is really just Java code that is inserted into the servlet that the Web server generates, so JSP scriptlet code can make use of nearly any class that Java includes. This gives great flexibility in terms of what you can actually include in this JSP code of your page.

JSTL is not so flexible. JSTL code is a new programming language that is not nearly as evolved as Java itself. This means that if you are to create a pure JSTL implementation, you do not have access to the number of classes that you would if you were using a JSP scriptlet.

Although this is a limitation, it should not hinder you too much. JSP pages should usually contain only presentation-level code. Although JSP scriptlets give you access to the entire JDK, do you really want to be opening socket connections from your JSP pages? Such things are usually left to JavaBeans.

Disadvantage: May Seem Burdensome for Experienced Programmers

Without a doubt, JSTL makes programming easier for a programmer with only an HTML skill set. However, for the advanced Java programmer who already knows how to use Java well, JSTL often is viewed as simply one more programming language to learn. Plus, if JSTL just gets translated into Java code anyway, an advanced programmer may wonder why he does not simply do that himself and save the time.

If a programmer is already familiar with Java, JSP scriptlet is not terribly hard to learn. This can make the equivalent JSTL code look larger and more complex. After all, all JSTL code is valid XML. This alone means extra typing for your programmers because it takes more keystrokes to produce an XML tag than does its scriptlet counterpart.

  • + Share This
  • 🔖 Save To Your Account