Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Yasir Karim

+ Follow
since Jul 21, 2011
Yasir likes ...
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 Yasir Karim

Congrats. Great score. All the best.
8 years ago
Hello Guys,

I cleared OCPJWCD 6.0 and scored 82%.

How I prepared:
Studied Heads first Servlets & JSP
Studied Servlets 3.0 Specs
Wrote some code

I must admit I did not go through the mock exams but would recommend it to others.

web.xml elements
servlet config via web.xml, web-fragment.xml, annotations, api
filters, listeners

All the best.

8 years ago
Good question. I have the same and will appreciate if someone can answer this.

As I understand, there is a single ServletContext per web-app in a single JVM. But I don"t understand that is meant by the following:

"If the ServletContext passed to the ServletContextListener’s
contextInitialized method was neither declared in web.xml or webfragment.
xml nor annotated with @WebListener then an
UnsupportedOperationException MUST be thrown for all the methods defined
for programmatic configuration of servlets, filters and listeners."
Thanks Christian for your explanation. Your observation regarding Glassfish 3.1 is very helpful since I was trying to test this on Glassfish 3.1 and was experiencing something against the specifications.

Regarding @WebInitParam annotations: I believe both of the following will do the job. Correct me if wrong.

@WebServlet (name="A",

@WebServlet (name="A", urlPatterns={"/next"}, initParams = {@WebInitParam(name="test",value="annotation")})

Thanks everyone.
When should a Servlet be throwing UnavailableException then?
Final Servlet 3.0 specs

Section 8.1.2

CODE EXAMPLE 8-3 @WebFilter annotation example @WebFilter(“/foo”)
public class MyFilter implements Filter {
public void doFilter(HttpServletRequest req, HttpServletResponse res)
} }

Comment: Don't you think the method signature is wrong?
It should be:
public void doFilter(ServletRequest arg0, ServletResponse arg1,
FilterChain arg2) throws IOException, ServletException {
A WebServlet is declared in web.xml with name A and also is annotated as follows:

@WebServlet (name="A",
public class GenServlet extends HttpServlet{

Which servlet configuration will be applicable in this case i.e. when both configs are configuring the same Servlet class under same name?
Also, which servlet configuration will be applicable in this case when both configs are configuring the same Servlet class under different names?

Assume that metadata-complete is false.



Servlet 3.0 specs are big. Would appreciate if you can mention the important topics to cover from that.

Assume that resource loading takes 2 minutes and we need to handle the situation when a request comes at that stage. I doubt a Servlet should be throwing UnavailableException in the subject case.
A question: Servlet 3.0 specs are big. Which areas to focus?
Any soft of tips will be highly appreciated.

Hello Everyone,

I have gone through the threads posted on the subject topic but couldn't find the appropriate answer. I am going through "Heads First Servlets & JSP 2nd edition" and understand that its for SCWCD 5.0 exam. So there will be some topics that I need to prepare out of it.

Can anyone list those topics and may be give some resources to prepare those?

I am sure this will help a lot of people.

Awaiting response to this.

Murach's Java Servlets and JSP does not seem to be written for the certification purpose.
Thanks. But how does the container know that these are the listeners interested in listening for some events?
Referring to all the listeners related to Servlet, it is a must to configure those in web.xml? Is there any listener that is not required to be configured in web.xml?

Hi All,

I am going through 2nd edition of Head First SErvlets and JSP. It a good book to follow. It makes learning really fun. Not sure if this is the right book for Web Component Developer Java 6?

Will appreciate responses and comments.