The Scriptlet:: Code Fragment %
The Scriptlet:: Code Fragment %
TheScriptlet:
A scriptlet can contain any number of JAVA language statements, variable or method
declarations,orexpressionsthatarevalidinthepagescriptinglanguage.
FollowingisthesyntaxofScriptlet:
<%codefragment%>
YoucanwriteXMLequivalentoftheabovesyntaxasfollows:
<jsp:scriptlet>
codefragment
</jsp:scriptlet>
Anytext,HTMLtags,orJSPelementsyouwritemustbeoutsidethescriptlet.Followingisthe
simpleandfirstexampleforJSP:
<html>
<head><title>HelloWorld</title></head>
<body>
https://www.tutorialspoint.com/jsp/jsp_syntax.htm 1/1