Chapter 38 Check Point Questions
Section 38.3
▼38.3.1
What is the file-name extension of a JavaServer page? How is a JSP page processed?
▼38.3.2
Can you create a .war that contains JSP in NetBeans? Where should the .war be placed in a Java application server?
▼38.3.3
You can display an HTML file (e.g., c:\test.html) by typing the complete file name in the Address field of Internet Explorer. Why can't you display a JSP file by simply typing the file name?
Section 38.4
▼38.4.1
What are a JSP expression, a JSP scriptlet, and a JSP declaration? How do you write these constructs in JSP?
▼38.4.2
Find three syntax errors in the following JSP code:
<%! int k %> <% for (int j = 1; j <= 9; j++) %> <%= j; %> <br />
▼38.4.3
In the following JSP, which variables are instance variables and which are local variables when it is translated into in the servlet?
<%! int k; %> <%! int i; %> <% for (int j = 1; j <= 9; j++) k += 1;%> <%= k><br /> <%= i><br /> <%= getTime()><br /> <% private long getTime() { long time = System.currentTimeMillis(); return time; } %>
Section 38.5
▼38.5.1
Describe the predefined variables in JSP.
▼38.5.2
What is wrong if the JSP scriptlet <% in line 7 in ComputeLoan.jsp (Listing 38.3) is replaced by JSP declaration <%!?
▼38.5.3
Can you use predefined variables (e.g., request, response, out) in JSP declarations?
Section 38.6
▼38.6.1
Describe the JSP directives and attributes for the page directive.
▼38.6.2
If a class does not have a package statement, can you import it?
▼38.6.3
If you use a custom class from a JSP, where should the class be placed?
Section 38.7
▼38.7.1
You can create an object in a JSP scriptlet. What is the difference between
an object created using the new operator and a bean created using the <jsp:useBean ... > tag?
▼38.7.2
What is the scope attribute for? Describe four scope attributes.
Section 38.10
▼38.10.1
Describe how a <jsp:useBean ... > statement is processed by the JSP engine.
▼38.10.2
How do you associate bean properties with input parameters?
▼38.10.3
How do you write a statement to forward requests to another JSP page?