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

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.