GoConqr has a new look! Let us know what you think.

Quiz

Questões - Componentes web reutilizáveis

Luis Felipe Guariento 9 questions

Take the quiz

Questions in this quiz (9)

  1. 1Match the valid use of the action < jsp:include > or the directive < %@ include >
    ( Select one choice )
    1. A<jsp:include url="catalog.jsp" />
    2. B<jsp:include page="http://myserver/catalog.jsp" />
    3. C<jsp:include flush="true" />
    4. D<jsp:forward flush="false" page="catalog.jsp" />
    5. E<jsp:include page="/servlets/catalogServlet" />
    6. F<%@ include page="catalog.jsp" %>
    7. G<%@ include file="/servlets/catalogServlet" %>
    8. H<%@ include file="catalog.jsp?category=gifts" %>
    9. I<% String fileURL = "catalog.jsp"; %>
      <%@ include file="<%= fileURL %>" %>
  2. 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)
    1. A<jsp:insert>
    2. B<jsp:include>
    3. C<jsp:directive.include>
    4. D<jsp:directive:include>
    5. E<%@ include %>
  3. 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)
    1. A<%@ include page="test2.jsp" %>
    2. B<%@ include file="test2.jsp" %>
    3. C<jsp:include page="test2.jsp" />
    4. D<jsp:include file="test2.jsp" />
  4. 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)
    1. A<jsp:include page="other.jsp" >
      <jsp:param paramName="user" paramValue="mary" />
      </jsp:include>
    2. B<jsp:include page="other.jsp" >
      <jsp:param name="mary" value="user" />
      </jsp:include>
    3. C<jsp:include page="other.jsp" >
      <jsp:param value="mary" name="user" />
      </jsp:include>
    4. D<jsp:include page="other.jsp" >
      <jsp:param param="user" value="mary"/>
      </jsp:include>
    5. E<jsp:include page="other.jsp" >
      <jsp:param user="mary" />
      </jsp:include>
  5. 5Identify the JSP equivalent of the following code written in a servlet. (Select one)
    RequestDispatcher rd = request.getRequestDispatcher("world.jsp");
    rd.forward(request, response);
    1. A<jsp:forward page="world.jsp"/>
    2. B<jsp:action.forward page="world.jsp"/>
    3. C<jsp:directive.forward page="world.jsp"/>
    4. D<%@ forward file="world.jsp"%>
    5. E<%@ forward page="world.jsp"%>
  6. 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)
    1. A<jsp:include page="test2.jsp" />
    2. B<jsp:forward page="test2.jsp" />
    3. C<%@ include file="test2.jsp" %>
    4. DNone of the above because objects placed in pageContexthave the page scope and cannot be shared with other components.
  7. 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
    1. Ablue
    2. Bred green blue
    3. Cblue red green
    4. Dblue green red
    5. Ered green
  8. 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
    1. Ablue red blue
    2. Bblue red red
    3. Cblue blue red
    4. Dblue red null
  9. 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
    1. Ared
    2. Bgreen
    3. Cblue
    4. DThe answer cannot be determined.

Information

Description
Concursos Públicos Desenvolvimento de Software (OCEJWCD 6 ONLINE COURSE) Quiz on Questões - Componentes web reutilizáveis, created by Luis Felipe Guariento on 09/04/2018.
Language
Português
Views
0
Tags
desenvolvimento de softwareocejwcd 6 online courseconcursos públicos
Rating
No ratings yet
Rate this quiz
Rate this quiz

More on JSP, JSTL e JSF

Feedback

What is it about?

What do you think of the new look?

How do you like it?