File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Enthuware query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Enthuware query" Watch "Enthuware query" New topic
Author

Enthuware query

Kejal Shah
Ranch Hand

Joined: Jun 27, 2003
Posts: 87
Guys, i took the enthuware JWebplus v4 test today. I had a query regarding the same. I'm posting it here and i hope i ain't violating any copyright laws.

Que:
You want the copyright information contained in <webapp root>/html/copyright.html to be added to the html content that your servlet generates. Which of the following code fragments occuring in doGet method would achieve this objective?

Select 1 correct option.
a. this.getServletContext().getRequestDispatcher("../html/copyright.html").include(request, response);
b. this.getServletContext().getRequestDispatcher("/html/copyright.html").include(request, response);
c. request.getRequestDispatcher("../html/copyright.html").include(request, response);
d. request.include("../html/copyright.html", request, response);
e. this.getServletContext().getRequestDispatcher("/html/copyright.html").forward(request, response);
f. request.getRequestDispatcher("/html/copyright.html").forward(request, response);

Ans: c
My ans: b

Their comments: 1. This is invalid because a relative path is being passed to getRequestDispatcher method of ServletContext. 2. This is valid because an absolute path is being passed to getRequestDispatcher method of ServletContext. (/html/copyright.html starts with a "/"). 3. This is valid because getRequestDispatcher() of ServletRequest interface supports absolute as well as relative paths. 4. There is no include method in request. 5 and 6. calling forward will forward the request to the given resource and so the data generated by this servlet will be lost.


Kejal<br />SaneDevil@gmail.com
trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Hi Kejal,

Even I gave the same answer as you have given and was surprised to see 2 answers popping up instead of one.

Even I am in a dilemma.

Thanks,
Javainn


Javainn<br /> <br />SCJP,SCWCD,SCBCD,<br />ICED (IBM-287,IBM-484,IBM-486)
IBM certified in DB2 V 8.1 Family Fundamentals (IBM 700)
Kejal Shah
Ranch Hand

Joined: Jun 27, 2003
Posts: 87
Cool! so tat means, the exam's a crap. I had problems with other questions too.
Rafael Pereira
Ranch Hand

Joined: Mar 23, 2005
Posts: 32
Enthuware is a decent simulator, very close to the real test (so everybody say). But these errors can be annoying.

You should report this to Enthuware, so they can improve the product in the next version.


Sun Certified Web Component Developer 1.4<br />Linux LPI Certified (LPIC-1)<br />Sun Certified Java Programmer 1.4
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Originally posted by Kejal Shah:
Cool! so tat means, the exam's a crap. I had problems with other questions too.


Kejal: That was a bit harsh. JWebPlus for the old exam had a very good reputation. Please post the questions at JDiscuss web site or send them to (jwebplus@enthuware.com or support@enthuware.com) and this would be fixed in the future releases.
Bhumika Thakkar
Ranch Hand

Joined: Apr 18, 2005
Posts: 79
the answer is b and c right?
bhumika


SCBCD (Preparing) <br />SCWCD, 82%<br />SCJP, 90%
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Originally posted by Bhumika Thakkar:
the answer is b and c right?
bhumika


YES.

1. ServletContext.getRequestDispatcher()
- accepts pathnames that must begin with a "/" and is interpreted as relative to the current context root

2. ServletRequest.getRequestDispatcher()
- accepts pathnames that are relative to the current servlet as well as pathnames that begin with a "/", which are interpreted as relative to the current context root.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enthuware query