What is disadvantages of using Java code in JSP files?

Posted by Rohit Kumar | Updated on

In this example, I have share drawbacks of Java coding in JSP Java server pages files.

The major disadvantages of scriptlets are:

  1. Reusability: you can’t reuse scriptlets.
  2. Replaceability: you can’t make scriptlets abstract.
  3. OO-ability: you can’t make use of inheritance/composition.
  4. Debuggability: if scriptlet throws an exception halfway, all you get is a blank page
  5. Testability: scriptlets are not unit-testable.
  6. Maintainability: per saldo more time is needed to maintain mingled/cluttered/duplicated code logic.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers