Yasir Karim

Greenhorn
+ Follow
since Jul 21, 2011
Yasir likes ...
Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
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.
6 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.

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

All the best.

Y.
6 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",
urlPatterns={"/next"})
@WebInitParam(name="test",value="annotation")


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

Regards/
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:
@Override
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",
urlPatterns={"/next"})
@WebInitParam(name="test",value="annotation")
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.

Thanks.

Guys,

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

Cheers
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.
Congrats.
A question: Servlet 3.0 specs are big. Which areas to focus?
Any soft of tips will be highly appreciated.

Thanks
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.

Regards,
Y.
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?

Cheers
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.

Cheers