Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
JSP is a view technology that mixes template markup with server-side behavior. While early JSP encouraged scriptlets (embedded Java), modern JSP emphasizes tag libraries and Expression Language to reduce Java code in pages.
Given Data / Assumptions:
Concept / Approach:
The claim “only in Java” is incorrect. JSP supports multiple constructs: static markup, JSP directives, standard/custom tags, and EL. Java classes (servlets, beans, tag handlers) implement behavior outside the JSP view, promoting separation of concerns.
Step-by-Step Solution:
Design the view with HTML/CSS.Use JSTL core tags for iteration/conditions instead of scriptlets.Bind model data via request/session attributes and EL.Move complex logic into Java classes (controllers, services).Configure via web.xml or annotations; JSP compiles to a servlet.
Verification / Alternative check:
Inspect typical JSPs in modern projects: minimal or no raw Java, heavy use of tags/EL.
Why Other Options Are Wrong:
Restricting to scriptlets is outdated and not required; pre–JSP 2.0 still allowed tags.
Common Pitfalls:
Embedding business logic in JSPs; overusing scriptlets and hurting maintainability.
Final Answer:
Incorrect
Discussion & Comments