ASSIGNMENT-2
Paper code: ETCS-308
Subject: Web Technology
Q1. JavaScript code used by a Web document must be in a file that can be read by
anyone who can access the document. In an attempt to keep others from using
their code, some JavaScript authors obfuscate their code—that is, attempt to
reduce the intelligibility of their code—in various ways. What does the following
obfuscate code do, and why?
var weird = "al" + "father".slice(4, 6) + "t";
window[weird]("Weird, but it works.");
Q2. A new visitor sends a request to the URL of a servlet that uses URL rewriting. Do
you think that the servlet response will contain the session ID in the HTTP header,
in URLs written to the body of the response, in neither, or in both? Justify your
answer. How could you test your hypothesis?
Q3. Write a complete JSP document that could be used as an error page. In particular,
this document should call the getMessage() method of the exception represented
by the implicit object exception and display the String returned by the method in an
XHTML document. Do not use scriptlet code within your document.
Q4. What is output, if the following JavaScript program is executed by a typical web
browser? Explain.
var i=5;
function duh()
{
var i;
window.i=6;
}
duh();
[Link](i);