Consider the code below:
Do the html tags go as it is to the browser?
No, they are converted to out.println statements when the servlet for JSP is created and then sent to browser, when a request comes from browser.
This also means that in the above example, "this is good hello" text is skipped if str!=null.
In fact, all the code in scriptlets is inserted into _jspService method.
<html>
<title>result</title>
<body>
<%= new java.util.Date()%>
<% String str = (String)session.getAttribute("name");
if(str == null) {
session.setAttribute("name","only hello");
%>
this is good hello
<% }
else {
out.println( str);
}
%>
</body>
Do the html tags go as it is to the browser?
No, they are converted to out.println statements when the servlet for JSP is created and then sent to browser, when a request comes from browser.
This also means that in the above example, "this is good hello" text is skipped if str!=null.
In fact, all the code in scriptlets is inserted into _jspService method.
0 Comments On This Entry
← January 2022 →
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
My Blog Links
Recent Entries
-
-
-
SCJP Notes - Part 6on Mar 27 2008 08:19 AM
-
SCJP Notes - Part 5on Mar 27 2008 08:05 AM
-
Recent Comments
Search My Blog
12 user(s) viewing
12 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)



Leave Comment









|