adspace
Explain scriptlet, expression and declaration in jsp.
Answer Posted / Devender Kumar
1. Scriptlet: It is a JSP construct that allows developers to write Java code within a JSP page using the <% %> delimiters. It is generally considered bad practice due to issues with maintainability and separation of concerns.
2. Expression: Expression is used to evaluate a simple Java expression within the JSP page using the <%= %> or ${} delimiters, which prints its value when the JSP page is executed.
3. Declaration: Similar to scriptlet but is used for declaring variables and initializing them, using the <%! %> delimiter.nThe use of scriptlets and declarations should be minimized to maintain a clean separation between Java code and presentation logic.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers