File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes errors on javaranch scwcd hints page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "errors on javaranch scwcd hints page?" Watch "errors on javaranch scwcd hints page?" New topic

errors on javaranch scwcd hints page?

Atul A. Shah

Joined: Aug 29, 2007
Posts: 4
Hello all,

Although the scwcd hints page ( contains some very useful reminders, I was hoping someone could corroborate that a few of the hints are in fact incorrect:

#11-- says of the <jsp:include> action that
"Page attribute accepts relative and absolute URLs."

This is in contradiction to the statement in section 5.4 of the jsp specification (jsp-2_0-fr-spec.pdf, p.1-109) where it says that:
"The resource is specificed using a relativeURLspec that is interpreted in the context of the web application."
The "page" entry in Table JSP.5-4 (p.1-110) repeats that:
"The URL is a relative urlSpecf as in Section JSP.1.2.1. Relative paths are interpreted relative to the current JSP page."

The faq also says of the include directive that:
"File attribute accepts relative and absolute URLs.", which appears to be contradicted in JSP.1.10.3 (p.1-51).

#14-- "A web.xml file that contains only an empty root element (<web-app></web-app> is perfectly legal."
is contradicted in section SRV.13.4 of the servlet spec (p.135 of servlet-2_4-fr-spec.pdf) where it says that:
"[The web-app] element has a required attribute "version"..."

#33-- Lists 4 steps in the creation of a custom tag.
Step 3, "Tell in the web.xml file about where to find the TLD file",
is not strictly necessary, since the specification defines a process whereby jsp containers automatically discover any .tld files within WEB-INF or a subdirectory (JSP.7.3.4, p.1-162).

Do you agree?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

#14 Agree. The statement is correct, but the example is not. It should be <web-app version="2.4"></web-app>.
#33 Agree. There's no need to edit web.xml.
#11 Difficult to say. By absolute, he probably wanted to refer to url starting with "/". This should be called "context relative". If it does not start with "/", it should be called "page relative". But I agree that it should be clearly written in the hints page.

If Jothi (who is making this hint page) is not around, I'll fix them.

[My Blog]
All roads lead to JavaRanch
Atul A. Shah

Joined: Aug 29, 2007
Posts: 4
Thanks Christopher.

I also wonder about hint #2:
"A <jsp:forward> effectively terminates the current page. Nothing before the <jsp:forward> or after the <jsp:forward> is written to the response! It is not the same when using a requestDispatcher.forward()."

Regarding requestDispatcher.forward(), SRV.8.4 states "If output data exists in the response buffer that has not been committed, the content must be cleared [by the container] before the target servlet's service method is called."...
"Before the forward method of the RequestDispatcher returns, the response content must be sent and committed, and closed by the servlet container."

These two statements together suggest that nothing before or after the forward method call is written to the response, just as with <jsp:forward>.

Is there any difference in the mechanics of the two approaches? Parameters sent to <jsp:forward> with <jsp aram> are equivalent to query string parameters appended to the resource name passed to the RequestDispatcher. <jsp:forward> can forward to a context-relative URI, just like the RequestDispatcher retrieved from a ServletRequest. I'm inclined to think that <jsp:forward> uses the RequestDispatcher to perform its forwarding. What do you think?
Atul A. Shah

Joined: Aug 29, 2007
Posts: 4
Correction: <jsp:forward> and RD.forward() (from ServletRequest) can accept both context-relative and page-relative paths.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10033

Thanks guys for the corrections. Though it came in very late, it will be useful for future exam takers...Thanks once again for the cooperation.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

I've committed the changes
I agree. Here's the link:
subject: errors on javaranch scwcd hints page?
jQuery in Action, 3rd edition