V Gala

Ranch Hand
+ Follow
since Aug 06, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by V Gala

Hi

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

http://www.javacertificationexams.com/scjp-mock-exams.php
http://jdiscuss.com/Enthuse/jsp/ShowAvailableTests.jsp
http://www.javacertificate.net/scwcd_1.htm
marcus green (www.examulator.com) contain 3 full mock test


All The Best
[ April 21, 2008: Message edited by: Christophe Verre ]
sorry
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
47
Marks: 1 Given that a servlet is correctly declared with the tag

<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>com.examulator.HelloWorld</servlet-class>
</servlet>
Which of the following represent the correct syntax for mapping a servlet url to a servlet name

a)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>hello</url-pattern>
</servlet-mapping>

b)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>*.java</url-pattern>
</servlet-mapping>

c)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

d)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/com.examulator.HelloWorld</url-pattern>
</servlet-mapping>


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?

examulator.com
<error-page>
<error-code>404</error-code>
<location>/not_found.html</location>
</error-page>

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
not_found.html


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();
response.setContentType("text/html");
out.println ("Worked....");
}
C public void doGet (HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
PrintWriter out = response.getWriter();
out.flush();
response.setContentType("myname");
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?
<auth-constraint>
<role-name>supervisor</role-name>
</auth-constraint>
Problem

Consider the following web.xml code snippet:


<servlet>
<servlet-name>BankServlet</servlet-name>
<servlet-class>com.abc.bankapp.BankServlet</servlet-class>
<security-role-ref>
<role-name>manager</role-name>
<role-link>supervisor</role-link>
</security-role-ref>
</servlet>


Which of the following statements are correct?


Options

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
jdiscuss

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/*


Answer
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