• Post Reply Bookmark Topic Watch Topic
  • New Topic

more doubts  RSS feed

vasu dev
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
01.1. public class SomeTag extends BodyTagSupport {
2. public int doAfterBody() throws JspException {
3. Object obj = pageContext.findAttribute("anObject");
4. return 2;
5. }
6. }
The PageCOntext.findAttribute method called in line 3 searches for which scopes (page
request session application)
<% double d = Math.random(); %>
<jsp:useBean id="goo" class="GooeyBean" />
<jsp:setProperty name="goo" property="kablpooey" YYY />
<%= goo.getKablooey() %>
Which substitution of YYY will store the value of d in goo.Kablooey?
03.If a servlet is designed to execute as a multi-threaded servlet and is NOT part of a
distributed Web application.
Will the servlet object is thread-safe?
Will multiple requests of the servlet are serialized by the servlet container?
Will the servlet container must use only one instance of the servlet class per servlet
definition in the Web application deployment descriptor?
Will the servlet container may instantiate multiple instances of the servlet class per
servlet definition in the web application deployment descriptor?
04.1. public void doGet (
2. HttpServletRequest request, HttpServletResponse response)
3. throws IOException, ServletException
4. {
5. RequestDispatcher dispatcher =
Which can be inserted in line 6 to retrieve a valid ResponseDispatcher object?
05.1.public class Acc2 extends HttpServlet {
2.public StringBuffer foo = new StringBuffer("foo');
3.public void doPost(HttpServletRequest req, HttpServlet resp) {
4.ServletConfig config = getServletConfig();
5.String param1 = config.getInitParameter("param1");
6.ServletContext context = getServletContext();
7.Object obj = context.getAttribute("OBJ");
Which two variables reference objects that are thread safe?
Which will invoke the servlet instance named foo?
07.which is true about the WEB-INF directory and its sub directories?
1. they contain both class files and JAR files?
2. JSP files in a web application must be located in the top level of the WEB-INF
3. the servlet container can serve HTML files located in the WEB-INF directory and its
4. THe java class loader can access resource files located in the WEB-INF directory and
its subdirectories
08.In the init method of a servlet, which exception is thrown to indicate that the servlet
is not ready to be placed into servlet?
what is the correct one?
09.when specified in a web application deployment descriptor which type of listener will
have no impact on application behavior?
httpservletlistener or servletcontextlistener or httpsessionbindinglistener or
10.<jsp:include page='fragment.jsp' />
describe the behavior of the include action....
11.what are the benifits of the MVC design pattern?
will it eliminates the need for servlets
will it separates business logic from presentation logic
will it minimizes coupling between objects which increases reusability
will it enables you to mix java code with html so that java code can be reused
will it allows software developers and page authors to work in parallel with few
will it groups the implementation of models, views, and controllers in a single object
which simplifies maintenance
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not doing ur homework!.....Some of the answers are quite trivial. I suggest you to do some serious study. Without hardwork,
you cannot pass the exam, even if you manage to pass the exam, it would not be of much help. All the best!
1. All 4 in the order: page, request, session, application.
2. value="<%= d %>"
3. NO, NO, NO, YES(quite possible)
4. There is nothing like ResponseDispatcher Object.
5. req, resp
6. -
7. true, false, false, true,
8. UnavailableException
9. ServletContextListener, HttpSessionAttributeListener
are configured in the web.xml
HttpSessionBindingListener is not configured in the web.xml
None of the listeners will have any effect on the application,
unless you have some logic written in these classes to affect
the application.
10. The output of the included page is included in the current page
at request page. The current page will resume its execution
after the call.
11. MVC does separate presentation logic from business logic. It also
increases modularity but there would be a lot of code to maintain.
Steve Agarwal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vasu,
read the manning book thoroughly and u will get most of the answers.
you can post the Q which you cant solve at all.
For most of them write a small program and run with some web server
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
03. The container will instantiate once for each servlet registration in web.xml. So, the answer is NO, NO, YES, NO.
Should the developer implement the SingleThreadModel interface, then the container may serialize requests on a servlet or maintain a pool of servlet instances.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!