BTC USD 81,412.2 Gold USD 4,378.12
Time now: Jun 1, 12:00 AM

What is a Scriptlet?

georgecarrter

Freshie
Messages
3
Joined
Dec 23, 2009
Messages
3
Reaction score
0
Points
3
A scriptlet can contain any number of language statements, variable or expressions that are valid in the page scripting language. Within scriptlet tags, you can declare variables to use later in the file, write expressions valid in the page scripting language, use any of the JSP implicit objects or any object declared with a <jsp:useBean>. Generally a scriptlet can contain any java code that are valid inside a normal java method. This will become the part of generated servlet's service method.
 
hai

Scriptlet code is embedded in the page JSP. The default language for scriptlets is Java, but it is possible to define other languages as well.

An example of scriptlet-based programming, which counts to 10, is shown here: <html> <head> <title>Count to 10 in JSP scriptlet</title> </head> <body><% for(int i=1;i<=10;i++){%><%=i%><br/><%}%> </body></html> As you can see from the preceding example, using scriptlet code produces page source code that contains a mix of HTML tags and Java statements.
 
A scriptlet contains a wide array of number language statement, variables or method of declarations. Scriptlet tag is a type tag used for inserting Java Code into JSP. As per my knowledge, scriptlets are executed at request time, when the JSP engine processes the client request.
 
Back
Top
Log in Register