JSP Basics
Scripting Elements
JSP Life Cycle
RANDOM
Advantages
100
Meaning of JSP
JavaServer Pages
100
Tags used for adding comments
<%-- comments -->
100
Name of the last phase of the Life Cycle
Cleanup
100
<%=“Fred”+ “ “ + “Flintstone %>
"Fred Flintstone"
100
What technology cannot contain dynamic content?
static HTML
200
Used to insert dynamic content into HTML.
JSP tags
200
Name of this tag: <%= %>
Expression tag
200
Step required to convert the JSP into servlet
Compilation
200
_____ GetCookies()... What does this function return?
Cookies[]
200
Technology only intended for simple inclusions
SSI
300
Phase where the page is compiled into a servlet
Translation phase
300
Scripting element used to embed java code.
Scriptlets
300
Method invoked in the initialization phase
jspInit()
300
A Comment Test

Today's date: <%= (new java.util.Date()).toLocaleString()%>

"Today's date: 6-Nov-2015 ??:??:??"
300
It is more convenient that what technology because you don't need to write print statements to generate the HTML?
Pure Servlets
400
How can i set a cookie
Cookie cookie = new Cookie("key", "value")
400
Tags used to define methods and instance variables
<%! %>
400
Method invoked in the execution phase that takes an HttpServletRequest and anHttpServletResponse as its parameters.
_jspService()
400
How can i set a session attribute
session.setAttribute(visitCountKey, visitCount)
400
It is better that what technology because it can generate dynamic content and also interact with the web server?
JavaScript
500
How can I set time to a cookie
cookie.setMaxAge(60*60*40)
500
Scripting element used to provide instructions to JSP engine
Directives
500
Steps in compilation
Parsing JSP Turning JSP into servlet Compiling the servlet
500
<%= if(Math.random() < 0.5) %> hello <%= } else { %> hi <%= } %>
Will not compile because they are JSP scriptlets and not expressions they should be enclosed by <% %>
500
It has an advantage over which technology because code is written in java, which makes it easier and also it is more portable to other operating systems and non-microsoft Web Servers?
Active Server Pages (ASP)
M
e
n
u