| Author |
more doubts
|
vasu dev
Greenhorn
Joined: Sep 21, 2003
Posts: 3
|
|
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) 02.<html><body> <% double d = Math.random(); %> <jsp:useBean id="goo" class="GooeyBean" /> <jsp:setProperty name="goo" property="kablpooey" YYY /> <%= goo.getKablooey() %> </body></html> 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 = 6. 7.} 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"); 8.} 9.} Which two variables reference objects that are thread safe? 06.<servlet-mapping> <servlet-name>foo</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> 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 directory 3. the servlet container can serve HTML files located in the WEB-INF directory and its subdirectories 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? unavailableexception illegalstateexception instantiationexception servletnotreadyexception illegalargumentexception 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 httpsessionattributelistener 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 dependencies will it groups the implementation of models, views, and controllers in a single object which simplifies maintenance
|
 |
Vishwa Kumba
Ranch Hand
Joined: Aug 27, 2003
Posts: 1064
|
|
Vasu, 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
Joined: Feb 02, 2003
Posts: 51
|
|
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 steve
|
SCJP1.4,SCWCD, SCBCD, SCEA part 1<br />"Its feels good to know the stuff in detail."
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
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.
|
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
|
 |
 |
|
|
subject: more doubts
|
|
|