David Bates

Ranch Hand
+ Follow
since Sep 03, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 David Bates

Thanks for everyone's help and the fantastic resource that is this forum.

For anyone who is studying for the exam, I have some notes that I made to help me revise and they are available for download. They are available in Visio and PDF format. Leave me a comment if you find them helpful.

My advice for anyone doing this exam:

1. Buy Head First Servlets and JSP. It's a really good book. There are a couple of areas it's weak on and there are a few important mistakes, but it did make the process much less painful.

2. Read Servlets and JavaServer Pages: The J2EE Technology Web Tier to revise the concepts. Unfortunately, there are quite a few mistakes in this book too (why don't they hire me to proof read this stuff?).

3. Scan through the Servlet and JSP specification documents.

4. Do all the exams on http://www.j2eecertificate.com.

5. Monitor the Java Ranch Forum(!)

More info on my blog
I conclude that the important word in the question is can. I hate questions like this. I've got the exam in a couple of days and I seem to spend all my time asking "What do they really mean by this question? Do they want me to be clever or not?"

Multiple choice limits my choices!
I've looked in the errata of this book and it says that the answer to Question 1 is incorrect.

"When using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException?"
The errata says that the correct answers are (b) flush and (c) write.

I would just like to confirm that this is correct. (b) I understand, but (c) I find a little bit more dubious.

The API for RequestDispatcher says that an IllegalStateException will be thrown "if the response was already committed". I would not think that a write would result in a commit. Or is the commit non-deterministic? Is that why the question says "can *often* lead to an IllegalStateException", rather than "*will* lead to an IllegalStateException"? Might the stream autoflush?

...a section to try and convince management that agile is a good idea? I've moved from an agile company to one which is decidedly not and I've had tremendous trouble trying to convince management that it's a good thing.
Sure, but I can't see it suggesting a technique that hasn't been discussed above, that's all.
Eric, was there something different I was meant to see in that link? It looks like the "hidden form submitted using Javascript" technique discussed earlier:

You should just call the serverside page directly in the window.open or an in iframe. Do not do an Ajax call since JavaScript can not handle binary data.



Agreed, doing some more digging it does appear AJAX just isn't fitted for fetching binary data.

However, how can you specify a POST method using the techniques you suggest?
Thanks. I had thought of that and it's what I'll do if all else fails.

I just think there has to be a way of passing back the binary data to the window.
I'm using an AJAX (POST) call to a servlet which streams back a Microsoft Word document. I arrives back safely, but I don't know how to spawn a new window (window.open) and populate it with the contents of that Word document. Any thoughts?
In what way do you think the Intercepting filter reduces the number of requests? The Intercepting filter pattern is applied to requests coming in from the client browser into the web server - you can't change the number of these requests (apart from asking users to stop visiting your website).

Once the server receives the request the controller will build a JSP view to return to the user. However, if that JSP page contains references to a remote EJB, a separate call will have to be made from the web container to the EJB container each time a method is called. For example, if "currentUser" refers to a remote object, the following snippet would cause *three* separate calls to the EJB container:

Current user is ${currentUser.name} who last logged in on ${currentUser.lastLogin} and has visited this site ${currentUser.numberOfVisits} times.

However, if you use the Transfer Object pattern you send back a simple Java object (POJO), rather than a reference to a remote object. This reduces the number of remote calls from 3 to 1, resulting in a performance gain.
Okay, so something is idempotent if it can be run multiple times without any negative side-effects, but GET goes one step further than that by not causing *any* side-effects?
With regards to the SCBCD exam...

If the SCWCD exam is anything to go by, don't expect the SCBCD to be much simpler with EJB 3.0. If anything it'll be more complicated. These exams don't scrap stuff from the syllabus just because it's been replaced by something better (e.g. Scriptlets, expressions, old-style custom tags). I'm sure you'll have to know how to do EJB 2.x.
As far as I know this is optional functionality. Tomcat can't do a "hot deploy", although other containers can.
Thanks for the definition, but I'm asking if these two statements contradict each other or not. Do they?
It's an error in the book. It should read:

"You do NOT configure session binding listeners OR SESSION ACTIVATION LISTENERS in the DD! ... But this is NOT true for the other session related listeners on the previous page. HttpSessionListener and HttpSessionAttributeListener must be registered in the DD, since they're related to the session itself, rather than an individual attribute placed in the session."

However, what if the implementing class isn't an attribute (which Pg 262 says it may be). Surely *that* class would need to be registered so that the container knows to notify it that the session is about to move?