| Author |
JavaBeat Sample Question
|
deepa raj
Ranch Hand
Joined: Jul 25, 2008
Posts: 124
|
|
Given the deployment descriptor for a Web Application is What will be the output of the following Servlet?
|
 |
sudhakar karnati
Ranch Hand
Joined: May 03, 2007
Posts: 93
|
|
Answer is 1. The Servlet will output 'javabeat null' in the Server Console. Thanks & Regards, Sudhakar Karnati
|
 |
Ramesh Ponnada
Greenhorn
Joined: Nov 05, 2004
Posts: 18
|
|
init-param tag is part of <servlet> not <servlet-mapping> So, above code will print 2 nulls.
|
Thanks<br />Ramesh <br />SCJP 5.0 | SCWCD 5.0
|
 |
Jan Sterk
Ranch Hand
Joined: Jun 06, 2008
Posts: 139
|
|
Originally posted by Ramesh Ponnada: init-param tag is part of <servlet> not <servlet-mapping> So, above code will print 2 nulls.
Good point!!
|
SCJP 1.4 (81%)<br />SCWCD 5 (95%)
|
 |
sudhakar karnati
Ranch Hand
Joined: May 03, 2007
Posts: 93
|
|
Answer is 1. The Servlet will output 'javabeat null' in the Server Console.
I ran the above example in Netbeans.and its extra features made me this mistake. Thanks Sudhakar
|
 |
Savyatha Reddy
Greenhorn
Joined: Jun 10, 2008
Posts: 14
|
|
|
so, is the above code gives an output of "javabeat null" OR "null null"
|
 |
Prasad Tamirisa
Ranch Hand
Joined: Mar 26, 2007
Posts: 130
|
|
so, is the above code gives an output of "javabeat null" OR "null null"
Its very clear. The Answer is null null
|
Regards,
Durga Prasad
|
 |
Srividhya Kiran
Ranch Hand
Joined: Feb 17, 2008
Posts: 166
|
|
Hello I think we get a compile time error by declaring <init-param> as a subelement of <servlet-mapping>. I am using eclipse and it gives me a error if I give <init-param> under <servlet-mapping> element. Srividhya
|
 |
Ramesh Ponnada
Greenhorn
Joined: Nov 05, 2004
Posts: 18
|
|
IDEs like eclipse, netbeans can have schema validation enabled. Because init-param is not a part of servlet-mapping it schema validation fails and eclipse reports it as a error in the problems view. (one can disable the validations in the eclipse preferences) Also, if you have XML-Validation turned on in the container(I am taking about Tomcat, I don't know how to do it in others) web application won't start/load. [ August 11, 2008: Message edited by: Ramesh Ponnada ]
|
 |
 |
|
|
subject: JavaBeat Sample Question
|
|
|