01.public class SessionAttr implements HttpSessionBindingListener {
public SessionAttr() {
System.err.println("Thanks for creating me");
}
public void attributeAdded(HttpSessionBindingEvent e) {
System.err.println("I have been added");
}
public void attributeRemoved(HttpSessionBindingEvent e) {
}
public void attributeUpdated(HttpSessionBindingEvent e) {
System.err.println("I have been updated");
}
}
WHat is printed to the stderr of the
servlet container as a result of an instance of
SessionAttr being set in a session?
02.public class BListen implements HttpSessionBindingListener {
public void valueBound(HttpSessionBindingEvent e) {
System.err.println("session attr bound");
}
public void valueUnbound(HttpSessionBindingEvent e) {
}
}
assuming the web application deployment descriptor contains the appropriate elements for
defining class BListen as a listener. what is the result?
03.which two require declaring multiple servlet definitions for the same servlet class in a
deployment descriptor?
1.implementing servlet chaining
2.giving each servlet definition a different name
3.allowing the servlet class to handle requests from different urls
4allowing each definition to have different initialization parameters
04.what are the two HttpServletResponse methods can cause an HTTP error to be returned in
the servlet's response?
05.WHich will provide the ability to write the servlet log?
06.1. public class MisterBean {
private
String firstName;
private int age;
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getFirstName() {
return firstName;
}
public void SetAge(int age) {
this.age = age;
}
public int getAge() {
return age;
}
}
Given index.
jsp;
<html><body>
<jsp:useBean id="myBean" class="MisterBean" />
<jsp:setProperty name="myBean" property="firstName" />
<jsp:setProperty name="myBean" property="age" />
<%= myBean.getFirstName() %>, <%= myBean.getAge() %>
</body></html>
For the given URL
http://localhost/index.jsp?fName=Fred&age=50 which change or (nochange) will cause "Fred, 50" to be included in the generated HTML?