Help coderanch get a
new server
by contributing to the fundraiser

Matteo Palmieri

+ Follow
since Sep 09, 2008
Merit badge: grant badges
For More
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 Matteo Palmieri

Hi all,

I'm reviewing my Data access class for the URLyBird 1.2.1 and I've noticed something I'm not sure it is worth worrying about.
I have implemented record caching in the form of a map where the key is the record number, and the value is a String[] vector
representing the room's data.

The readRecord() simply returns the corresponding String[] instance object from the cache.
Similarly the updateRecord() and createRecord() change/add the String[] object into the cache.

As the Data class uses String[] objects created by the client and exposes String[] objects belonging to the cache it would be
much safer to make a deep copy of the array before it is returned to the client or put into cache, but this would be an
additional overhead. Otherwise I could rely on the assuption that the client does not change the array's content after having
been passed to/returned from the Data class.

What do you think would be the best approach ?

I made the Data class a Singelton and the Data class is going to work with the file access, but now I cannot pass a db file and path name through it constructor. Would the solution here be to not make Data a singelton but keep all methods of Data synchroized?

This is an interesting question I've been asking myself several times. The solution proposed by Roberto is good, but there are several cases where the getInstance with parameters requires special exception handling code that would be a burden to replicate in every piece of code where this method is called. Furthermore it usually happens that the part of the application where the singleton is actually instantiated (the first time is used) is known at compile time so it would make sense to limit the parameter passing and exception handling to this piece of code.
I faced this situation by implementing a slight deviation to the singleton pattern as documented below. I'd like to get your opinions about that.
Congratulation for the great score !
Could you please describe at high level your solution ?

Hi Marut,

please check this thread for an answer to your question.

Hi Ani,

is it true that for filters the definition order in the DD is relevant, but make sure you know
that the following rules will be applied by the servlet container in the specified order:
1) Apply all filters with url-pattern matching the request (in the same order they are defined)
2) Apply all filters with servlet-name matching the request (in the same order they are defined)


The order will be: Filter1, Filter3, Filter2, Filter4, that is Filter2 and Filter4 will be coming after because they match a servlet-name

Regards, Matteo
Vijitha is correct. The container will try to find a match of the URL in the request not based on the declaration order, but according on the following order:

1) Exact match of the URL (e.g. /data/
2) longest path prefix (e.g. /data/*)
3) Extension mapping (e.g. *.do)
4) Default servlet (e.g. /)

aniruddhaa jadhaoa wrote:Congrats Buddy . Kudos.
I want to know few option about SCWCD question.
What type of question really are in exam , and on which topic the enforcement has been given in the exam, meas on whic topic the question really are based upon?
I am planning to get on the exam 24th of this month.
Can you please answer my few queries above?
Looking for reply.

Hi aniruddhaa,

in my experience the type of questions you get on the exam are quite similar to the ones you can see in a mock exam from enthuware and they are generally simpler. So if you get a good score on enthuware there are good chances you will get the same or better score on the real exam.

Good luck

15 years ago
if you want to test it, on firefox 3.0.x you can get a feeling of what application will be used for each mime type by selecting Tools->Options->Applications(Tab). The column on the left is the mime type. On the right you see the application that will handle the content.
Hi everybody,

I want to share with you that today I passed the SCWCD :lol:
I owe you this because the posts I've read in these months and the help I got from this community is very valuable. Thank you!

Now, my two cents on my exam preparation journey:
- I've been studying for 5 months, almost one hour per day. In my current job I'm not coding but I used to. Almost two years ago I've been working on web applications only based on servlet technology so I spent a few hours during the preparation to review specific topics on JSP and custom tags using real code.

- Main reference book: Sun Certified Web Component Developer Study Companion (Charles Lyons). It is very good in my opinion since it covers all the topics in detail and follows a "classic" approach in the teaching. There are a few errors in the Revision Questions but most of them are already mentioned in the errata. It also includes a free mock exam from Sun where I scored 78% just a few days before the exam.

- Mock questions: Enthuware. This is a very good tool, not too expensive, to exercise during the preparation and understand in which area to improve. My average score on the 8 standard tests has been 84%

Of course I've been browsing sometimes through the JSP, Servlet and JSTL specification to find answers to specific questions
No need to say that I've been looking in the forum as soon as a new question came in :-)

So... who's next ? Good luck !!

15 years ago
Hi, at page 344 of the "Sun Certified Web Component Developer Study Companion" from Charles Lyons
can be found this question:

What is the difference between the following two tag declarations ?

(A) There is no difference; these are identical statements
(B) The first statement instantiates a new instance if one isn't available in the scoped attribute, while the second throws a runtime exception.
(C) The first statement tries to retrieve the object from serialised form before instantiating a new instance.
(D) The second statement tries to retrieve the object from serialized form before instantiating a new instance.
(E) The first statement sets the JSP scripting variable called user while the second does not.

The given answer is (D). My questions are:
1) I know that the beanName attribute should be used together with the type attribute, so (D) should not hold true...
2) What is supposed to be the containers behaviour when two jsp:useBean are used on the same page referring to the same id ?

Thanks in advance for your help
Hi Poonam,

I'm not sure I've understood your question. If the case, could you please rephrase that ?
If your question is how is it possible that the tag2 can possibly be defined as empty, scriptless or JSP
in the TLD, the answer is that every tag, regardless of its body-content definition can be used with
no body, so we cannot infer anything specific about the body-content definition for the TLD of this tag
and this is the reason why all options are acceptable.
Different is the case of a custom tag like tag1 which has a body and other
nested tags. In this case we can infer that its body-content definition in the TLD
cannot be either empty or scriptless, but it must be JSP.

Objective 9.3 of the SCWCD exam says:

Given a design goal, use an appropriate JSP Standard Tag Library (JSTL v1.1) tag from the "core" tag library

The c:redirect tag is part of the "core" subset of JSTL (JSTL v1.1 core )