Advanced Java Dseb4 Answers
Advanced Java Dseb4 Answers
(a) Servlets vs Applets: - Servlets run on server; Applets run on client browser.
(c) Custom Tags in JSP: - Use tag handler class and TLD file.
<tag>
<name>hello</name>
<tag-class>mypack.HelloTag</tag-class>
</tag>
(d) JavaScript Data Types: - String, Number, Boolean, Object, Undefined, Null, Symbol, BigInt.
(e) NaN Property: - Means "Not a Number". Occurs in invalid arithmetic like 0/0.
$("#id").css("color", "red");
1
(c) Scripting Elements: - Declaration <%! %> , Scriptlet <% %> , Expression <%= %>
(a) jQuery Definition: - JavaScript library simplifying HTML DOM and AJAX.
$("#form").submit(function(){
if($("#name").val()==="") alert("Name required");
});
(d) jQuery.length:
alert($("p").length);
HttpSession s = request.getSession();
2
session.invalidate();
(b) JSP Exception Handling: - <%@ page errorPage="..." %> and exception object.
(b) empty vs remove vs detach: - empty(): removes content. - remove(): removes element. - detach():
removes but preserves data/events.
(d) setAttribute():
session.setAttribute("name", "Deb");
(e) Factory Pattern Advantages: - Loose coupling, central control of object creation.
3
<%@ page session="false" %>
(a) Cookies:
4
$("#input").blur(()=> alert("Blur"));
$("#div").hover(()=> alert("Hovered"));
let arr=[];
arr.push(3); arr.push(1);
console.log(arr.reverse());
console.log(arr.sort());
5
$("#form").validate({
rules: { name: "required" },
messages: { name: "Enter name" }
});