Quiz
Questões - Componentes web reutilizáveis
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (9)
1Match the valid use of the action < jsp:include > or the directive < %@ include >
( Select one choice )- A<jsp:include url="catalog.jsp" />
- B<jsp:include page="http://myserver/catalog.jsp" />
- C<jsp:include flush="true" />
- D<jsp:forward flush="false" page="catalog.jsp" />
- E<jsp:include page="/servlets/catalogServlet" />
- F<%@ include page="catalog.jsp" %>
- G<%@ include file="/servlets/catalogServlet" %>
- H<%@ include file="catalog.jsp?category=gifts" %>
- I<% String fileURL = "catalog.jsp"; %>
<%@ include file="<%= fileURL %>" %>
2Which of the following JSP tags can be used to include the output of another JSP page into the output of the current page at request time? (Select one)
- A<jsp:insert>
- B<jsp:include>
- C<jsp:directive.include>
- D<jsp:directive:include>
- E<%@ include %>
3Consider the contents of the following two JSP files:
File 1: test1.jsp
<html><body>
<% String message = "Hello"; %>
//1 Insert LOC here.
The message is <%= message %>
</body></html>
File 2: test2.jsp
<% message = message + " world!"; %>
Which of the following lines can be inserted at //1 in test1.jsp so that it prints "The message is Hello world!" when requested? (Select one)- A<%@ include page="test2.jsp" %>
- B<%@ include file="test2.jsp" %>
- C<jsp:include page="test2.jsp" />
- D<jsp:include file="test2.jsp" />
4Which of the following is a correct way to pass a parameter equivalent to the query string user=mary at request time to an included component? (Select one)
- A<jsp:include page="other.jsp" >
<jsp:param paramName="user" paramValue="mary" />
</jsp:include> - B<jsp:include page="other.jsp" >
<jsp:param name="mary" value="user" />
</jsp:include> - C<jsp:include page="other.jsp" >
<jsp:param value="mary" name="user" />
</jsp:include> - D<jsp:include page="other.jsp" >
<jsp:param param="user" value="mary"/>
</jsp:include> - E<jsp:include page="other.jsp" >
<jsp:param user="mary" />
</jsp:include>
- A<jsp:include page="other.jsp" >
5Identify the JSP equivalent of the following code written in a servlet. (Select one)
RequestDispatcher rd = request.getRequestDispatcher("world.jsp");
rd.forward(request, response);- A<jsp:forward page="world.jsp"/>
- B<jsp:action.forward page="world.jsp"/>
- C<jsp:directive.forward page="world.jsp"/>
- D<%@ forward file="world.jsp"%>
- E<%@ forward page="world.jsp"%>
6Consider the contents of two JSP files:
File 1: test1.jsp
<html><body>
<% pageContext.setAttribute("ninetyNine", new Integer(99)); %>
//1
</body></html>
File 2: test2.jsp
The number is <%= pageContext.getAttribute("ninetyNine") %>
Which of the following, when placed at line //1 in the test1.jsp file, will allow the test2.jsp file to print the value of the attribute when test1.jsp is requested? (Select one)- A<jsp:include page="test2.jsp" />
- B<jsp:forward page="test2.jsp" />
- C<%@ include file="test2.jsp" %>
- DNone of the above because objects placed in pageContexthave the page scope and cannot be shared with other components.
7Consider the contents of two JSP files:
File 1: this.jsp
<html><body><pre>
<jsp:include page="that.jsp" >
<jsp:param name="color" value="red" />
<jsp:param name="color" value="green" />
</jsp:include>
</pre></body></html>
File 2: that.jsp
<%
String colors[] = request.getParameterValues("color");
for (int i=0; i<colors.length; i++){
out.print(colors[i] + " ");
}
%>
What will be the output of accessing the this.jsp file via the following URL?
(Select one)
http://localhost:8080/chapter12/this.jsp?color=blue- Ablue
- Bred green blue
- Cblue red green
- Dblue green red
- Ered green
8Consider the contents of two JSP files:
File 1: this.jsp
<html><body>
<%= request.getParameter("color") %>
<jsp:include page="that.jsp" >
<jsp:param name="color" value="red" />
</jsp:include>
<%= request.getParameter("color") %>
</body></html>
File 2: that.jsp
<%= request.getParameter("color") %>
What will be the output of accessing the this.jsp file via the following URL? (Select one)
http://localhost:8080/chapter12/this.jsp?color=blue- Ablue red blue
- Bblue red red
- Cblue blue red
- Dblue red null
9Consider the contents of three JSP files:
File 1: one.jsp
<html><body><pre>
<jsp:include page="two.jsp" >
<jsp:param name="color" value="red" />
</jsp:include>
</pre></body></html>
File 2: two.jsp
<jsp:include page="three.jsp" >
<jsp:param name="color" value="green" />
</jsp:include>
File 3: three.jsp
<%= request.getParameter("color") %>
What will be the output of accessing the one.jsp file via the following URL? (Select one)
http://localhost:8080/chapter12/one.jsp?color=blue- Ared
- Bgreen
- Cblue
- DThe answer cannot be determined.
Informationen
- Beschreibung
- Concursos Públicos Desenvolvimento de Software (OCEJWCD 6 ONLINE COURSE) Quiz am Questões - Componentes web reutilizáveis, erstellt von Luis Felipe Guariento am 09/04/2018.
- Sprache
- Português
- Aufrufe
- 0
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz