Back to the 2023 paper

Module III: Basics of Web Programming

20232m

What is scriptlet?

Worked SolutionAI Assisted

A scriptlet is a block of Java code embedded directly inside a JSP (JavaServer Pages) page, written between <% and %>. The code runs on the server each time the page is requested, and its output becomes part of the HTML sent to the browser.

<%
  int count = 5;
  for (int i = 1; i <= count; i++) {
      out.println("Line " + i + "<br>");
  }
%>

Related JSP elements: declaration <%! ... %>, expression <%= ... %>, and directive <%@ ... %>.

Similar questions

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.