Cracking the Java Coding Interview pdfdrive com


Question What is the difference between RequestDispatcher and


Download 1.48 Mb.
Pdf ko'rish
bet84/182
Sana02.05.2023
Hajmi1.48 Mb.
#1423275
1   ...   80   81   82   83   84   85   86   87   ...   182
Bog'liq
Cracking the Java Coding Interview ( PDFDrive )

Question What is the difference between RequestDispatcher and
sendRedirect? (JSP)
Answer RequestDispatcher: server-side redirect with request and response
objects. sendRedirect : Client-side redirect with new request and response
objects.
Question How does JSP handle runtime exceptions? (JSP)
Answer Using errorPage attribute of page directive and also we need to specify
isErrorPage=true if the current page is intended to URL redirecting of a JSP.
Question How do you delete a Cookie within a JSP? (JSP)
Answer
Cookie mycook = new Cookie("name","value");
response.addCookie(mycook);
Cookie killmycook = new Cookie("mycook","value");
killmycook.setMaxAge(0);
killmycook.setPath("/");
killmycook.addCookie(killmycook);


Question How do I mix JSP and SSI #include? (JSP)
Answer If you're just including raw HTML, use the #include
directive as usual inside your .jsp file.
But it's a little trickier if you want the server to evaluate any JSP code that's
inside the included file. Ronel Sumibcay
(ronel@LIVESOFTWARE.COM) says: If your data.inc file contains
jsp code you will have to use
<%@ vinclude="data.inc" %> The is used for
including non-JSP files.
Question I made my class Cloneable but I still get 'Can't access protected
method clone. Why? (Core Java)
Answer Yeah, some of the Java books, in particular "The Java Programming
Language", imply that all you have to do in order to have your class support
clone() is implement the Cloneable interface.
Note: Not so. Perhaps that was the intent at some point, but that's not the way it
works currently. As it stands, you have to implement your own public clone()
method, even if it doesn't do anything special and just calls super.clone().

Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   80   81   82   83   84   85   86   87   ...   182




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling