Explain scriptlet, expression and declaration in jsp.



Explain scriptlet, expression and declaration in jsp...

Answer / 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

More JSP Interview Questions

What is the use of pagecontext in jsp?

1 Answers  


Which categories can be divided jstl tags, give examples.

1 Answers  


which situation you use static include and dynamic include in jsp?

2 Answers   L&T,


What is jsp servlet?

1 Answers  


What is jsp and its uses?

1 Answers  


What are the advantages of jstl?

1 Answers  


Which two interfaces does the javax servlet jsp package have?

1 Answers  


Can we use javascript in jsp?

1 Answers  


Explain scriptlet, expression and declaration in jsp.

1 Answers  


i am using rich faces datatable rich:datatable. On entering the value, values get filtered in table. Now how can i get the value in back9ing bean..?

1 Answers  


What is the page directive is used to prevent a jsp page from automatically creating a session?

1 Answers  


What is include directive in jsp?

1 Answers  


Categories