Term
<% String s = s1 %> <%! String s1 = "hello"; %>
Will this compile? |
|
Definition
No because since scriptlets become part of the _jspService () , the variables declared become local variables, so order is important. |
|
|
Term
<%! int i; !%> (glob) <% int j; %> (loc) The value of i is <%= i++ %> 1 The value of j is <%= j++ %> 2 Which line will cause an error and why? |
|
Definition
line 2 because j is not initailized, since instance variables are intilized by default, while local variables like in line2 are not. |
|
|
Term
<%! is an example of
1. delcaration 2. scriptlet 3. expression |
|
Definition
|
|
Term
<% is an example of
1. delcaration 2. scriptlet 3. expression |
|
Definition
|
|
Term
<%= is an example of
1. delcaration 2. scriptlet 3. expression |
|
Definition
|
|
Term
Is this a valid JSP construct <%=myObj.m1(); %> |
|
Definition
INvalid because the sign = makes it a JSP Expression, and they should never be terminated with a semicolon. |
|
|
Term
Is this valid? <% int x= 4, y = 5; %> <%=x=y%> |
|
Definition
Yes it is valid. translated to out.print(x=y) |
|
|
Term
What is wrong with the following? <%@ page language='java' %> <% int x= 0; int incr() { return ++x; } %> |
|
Definition
Can't define methods in a scriptlet. Upon translation the _jspService will had the method inside _jspService() which is illegal |
|
|
Term
1. <% int x = 3; %> 2. <%! int x = 5; %>
Which declaration is local to the class? |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to interfac javax.servletServletContext is.... |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to interface javax.servlet.http.HttpSession.... |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to interface javax.servlet.http.HttpServletRequest.... |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to interface javax.servlet.http.HttpServletResponse.... |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to class javax.servlet.jsp.JspWriter.... |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to class java.lang.Object |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to class javax.servlet.jsp.PageContext |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to class java.lang.Throwable.... |
|
Definition
|
|
Term
The implicit variable available to JSP page that belongs to interface javax.servlet.ServletConfig.... |
|
Definition
|
|
Term
________ pageContext = null; |
|
Definition
|
|
Term
|
Definition
|
|
Term
_______ application = null; |
|
Definition
|
|
Term
_______________ config = null; |
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
application variable
String path = application.getRealPath("") same as String path =__________.getRealPath |
|
Definition
|
|
Term
<%@page session ="false" %> Session ID = <%session.getId()%>
compile? |
|
Definition
no because session = false indicates that the current page will not participate in an HTTP session, so the implicit variable session is unavailable. |
|
|
Term
String remoteAddr = ____getRemoteAddr();
Request or Response? |
|
Definition
|
|
Term
__.setContentType("text/html...");
Response or Request? |
|
Definition
|
|
Term
Which will compile?
<%= page.getServletInfo() %> <% this.getServletInfo() %> |
|
Definition
<% this.getServletInfo() %> because page is a class of java.lang.Object so it cannot be used to directly call the servlet methods. |
|
|
Term
The four scopes of object in JSP pages are 1. Application 2. Session 3. Request 4. __________ |
|
Definition
|
|
Term
Objects in which scope are accessible to all of the web applications of a servlet container? |
|
Definition
There is no scope that can share objects across mutliple web applications. To do that, we have to either use SErvlet Context.getContext() or use an external database. |
|
|
Term
What is wrong with the above? |
|
Definition
Expression and Declaration should be lower case. (case sensitive) |
|
|
Term
Static includsion, the contnets of another file are included we use include.
How to write this JSP style? |
|
Definition
<%@ include file="link" /> |
|
|
Term
In dynamic includsion, when the JSP page is requested, it sends a request to another object, and the output from that object is included in the requested JSP page. We use which 2 actions? |
|
Definition
|
|
Term
Using jsp:forward
1. RequestDispatcher rd = request.getRequestDispatcher('o.jsp"); rd.forward(request, response)
HOw can we write this another way? |
|
Definition
1. pageContext.forward('"o.jsp");
2. |
|
|