SCWCD include

2 respostas
andrepestana

Pessoal,

quero tirar uma dúvida nessa questão:

QUESTION 131:
A JSP page, current.jsp, is created to display the current weather report. The
weather report is contained in a weather.html page that is rewritten every five
minutes.
Which line, appearing in current.jsp, ensures that the most recent version of
weather.html is included whenever current.jsp is referenced?

A. <%@ include file= “weather. html”%>
B. <%@ forward file= “weather. html”%>
C. <%@ include page= “weather. html”%>
D. <jsp:include page= “weather. html”%>
E. <jsp:forward page= “weather. html”%>

A resposta correta é a D. Sei que <jsp:include page= “weather. html”%> inclui o resultado da requisição e <%@ include file= “weather. html”%> inclui o conteúdo do arquivo, mas eu fiz um teste aqui e os dois atualizam o conteúdo se os includes forem modificados. Por que a resposta certa é a D? Seria pq a D é a única que garante que a página incluída é a mais atual?

2 Respostas

Carol_M_de_Paula

Voce por acaso estah usando o Container Tomcat?
Se sim, eh pq o Tomcat eh um container “esperto” que detecta as mudancas no seu arquivo html.
Porem a especificacao JSP nao garante que isso aconteca com todos os containers.

andrepestana

Sim, Carol. Estou usando o Tomcat.

Acho que entendí. É só porque não é garantido que isso sempre vá ocorrer.

Obrigado por responder!

Criado 6 de abril de 2009
Ultima resposta 6 de abr. de 2009
Respostas 2
Participantes 2