V Gala

Ranch Hand
+ Follow
since Aug 06, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by V Gala


thanks to all of you

Try to remember which method is in which class or interface(eg ServletRequest or HttpServletRequest)

Read or memorize all note point or exam point given in Head First Servlet & JSP
Memorize the structure of deployment environment and element of web.xml

In exam try all option before giving final exam

drag and drop question were easiest

gave free mock exam from

marcus green (www.examulator.com) contain 3 full mock test

All The Best
[ April 21, 2008: Message edited by: Christophe Verre ]
i agree option c is correct

why option e is correct
tagdir can have value liketagdir="META-INF/TAG/ABC/TLD"
Which of the following statements are true?
a. Custom tags must always be wrapped as a Jar file before they are used
b. To use a tag library it must be configured within the deployment descriptor
c. A JSP page can refer directly to a TLD file within the taglib directive even if it is not in the deplyment descriptor
d. The uri attribute of the JSP taglib directive is mandatory
e. An error will occur if the tagdir attribute does not start with /WEB-INF/tags

answer given ia c,e

why option c is correct

source ->www.examulator.com
say true or false
A JSP document (i.e. in XML syntax) must start with the root tag

I think it is false

source ->examulator.com
Marks: 1 Given that a servlet is correctly declared with the tag

Which of the following represent the correct syntax for mapping a servlet url to a servlet name





Choose at least one answer.
a. a
b. b The servlet container doesn't care that the extension is .java it just sees it as a string and maps to it.
c. c This is a fairly standard maping and would match any given URL.
d. d I wouldn't recommend this type of mapping but it does work.

Answer is 3 and 4
why option 2 is wrong?


The above entry in the Deployment Descriptor will do what?

1 Route any request to your web application for a page or servlet that
cannot be found to not_found.html

2 Route any ServletExceptions with the code 404 thrown from your servlet to

3 Route any exception thrown in a servlet to not_found.html

4 Route any 404 requests to not_found.html

Answer given is 1

does anyone know explanation for answer
Which of the following code will work fine ? Assume all the variables are initialized

properly. Select two
A public void doGet (HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
PrintWriter out = response.getWriter();
ServletOutputStream stream = response.getOutputStream();
out.println ("Worked....");
B public void doGet (HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
PrintWriter out = response.getWriter();
out.println ("Worked....");
C public void doGet (HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
PrintWriter out = response.getWriter();
out.println ("Worked....");

D None of the above

B and C

Answer A is incorrect because we cannot call getOutputStream after getWriter. it will throw an IllegalStateException. Answer B will work fine. Answer C also will work fine even though myname is not a valid content type. The container will think that it

is a new mime type.

Is option c a valid answer?
if i have this code in web.xml
then option 2 is correct?

Consider the following web.xml code snippet:


Which of the following statements are correct?


Select 1 correct option.

1 The servlet code should use "manager" as a parameter in request.isUserInRole() method.

2 The servlet code can use "manager" or "supervisor" as a parameter in request.isUserInRole() method.

3 The servlet code should use"supervisor" as a parameter in request.isUserInRole() method.

4 The role of "manager" must be defined in the servlet container.
"supervisor" must be defined in the container. For example, in conf/tomcat-users.xml for Tomcat.

5 None of these.

which one is correct
1 or 2
Answer given is 1

why option 2 is wrong

thanks in advance
Say true or false
if foo1.tag and foo2.tag both reside in web-inf/tag then container will consider them apart of the same tag library

I think it is false
what is the answer?

thanks in advance
I am still getting that error message
I tried tld in classes folder
the code was running properly.
we people need to thank all of your team for such good website
when i am trying to open mock exam link it is giving following error

Error page Scwcd_Error

An error occured in the bean. Error Message is: 0 >= 0
Stack Trace is :
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:431)
at com.javaranch.jspbeans.scwcd.QuizBean.execute(QuizBean.java:210)
at __jspPage7_carl_scwcd_scwcd_mock_jsp._jspService(__jspPage7_carl_scwcd_scwcd_mock_jsp.java:92)
at com.orionserver.http.OrionHttpJspPage.service(.:56)
at com.evermind._cp._vhc(.:5639)
at com.evermind.server.http.JSPServlet.service(.:31)
at com.evermind._deb._lnc(.:514)
at com.evermind._deb._wmb(.:170)
at com.evermind._co._wbb(.:581)
at com.evermind._co._fs(.:189)
at com.evermind._bt.run(.:62)
128 Which are valid URL mappings to a servlet in a web deployment descriptor?
A */*
B /*.do
C /MyServlet
D scwcd/MyServlet
E /MyServlet/*

B, C and E

The servlet mapping must be relative to context root, that means it should start with "/"

Is Option B a valid answer ->For Extension match it must start with a asterik(*) and have a dot extension