Sebastien Col

Greenhorn
+ Follow
since Aug 18, 2005
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 Sebastien Col

Hello,
I would say that the synchronization is useful for "shared" scopes like session scope.
In this case (request scope) I don't think synchronization changes anything. But in the case of session scope, you would have to synchronize on the session object.
As this code is generated, it always synchronizes on the scope.

Sebastien
Hi,
Check the page 381 of the book. It says that the "initParam" implicit object is a Map that contains context init parameters.
When you context, think application. Servlet init parameters are available from a ServletConfig.
This is why the B answer is the correct answer.

Sebastien
Hi,
The difference between encoding and encryption is that encryption is reversible.
When you encrypt something, you can decrypt it.
On the other hand, when you encode something (MD5 for example) you can't reverse the process. It only guarantees that when you encode the same thing twice, you'll always get the same result.
Sebastien
Hi,
As it is the container that manages a servlets lifecycle, you must define a generic way of working for all servlets.
You can't use the constructor because otherwise you would have to modify the container to tell him to instanciate this particular servlet.
Sebastien
Hi,
I think that's because it is the container that actually read the deployment descriptor, not the servlet.
Then the container instantiate the servlet and pass it its configuration information.
The container passes this information through name/value pairs.

Sebastien
Hi,
you can secure the FORM method using a protected transport layer connection. Most containers use HTTPS over SSL to implement this layer.

You can tell the container that you want confidentiality an d integrity by adding the <user-data-constraint> tag to the apprapriate <security-constraint>.

For example :
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>

Sebastien
Hi,

The problem is that when you initialize a variable, the type of the init value must match the type of the variable.
Here, you have an Object type variable named "objects2" and you have a Pizza[] init value. Types don't match.

Arrays are extensions of the Object class. It is then possible to affect an array to an Object variable. The following code is valid:

Object[] objectsTab = {new Pizza(), new Pizza()};
Object obj = objectsTab;

I guess the difference is that during initialization, the JVM will allocated memory space to store the init value. I think that's why types must match, so that the JVM will have necessary information to allocate enough memory.

Sebastien
Hi,

Q. Why is there a compile time exception at 2 ?
R. Because of the [] that is before the a4 identifier. The first part of the line says that you're declaring int arrays, the first one being named "a3". Then, after the coma, you must have only identifiers, as following:

int []a3, a4;

Q. Is a5 a 1-D array & a6 a 2-D array ?
R. Yes. a5 is an int[], and a6 is an array of int[].

Sebastien.
No, your bean must expose a setter for the property you're setting through the <c:set>.
I tried with a public property, it doesn't work either.

Sebastien
Hi,
Did you add the ch1 context in the server.xml file ?
Which error do you actually get ?
Seb
Hi,
I guess that's because your child class extends parent so it has only 2 methods :
void test(parent pp)
void test(child cc)

but there is NO test method that takes a grandkid class as an argument.
As grandkids extends child, a grandkids is a child.
Then when you call the cc.test(gc), the gc is considered as a child, that's why it prints out "in child", because it's the test(child cc) method that is executed.
I hope it was clear...
Sebastien
Hi,
The scope attribute of the jsp:useBean tag defaults to page. Here no scope is specified so the jsp:useBean looks into the page scope before creating the bean.
The assumed parameter "mystring" is in the request, not in the page scope. So the bean is actually an empty string.
That why it prints "".

Sebastien
Hi Amal,
I'm preparing for the exam and the "Head first Servlets and JSP" is a great book. Very focused and clear on what you need to know for the exam.
It's also very original in the way it presents its content. I often laugh when I read it. It's a pleasure to learn with that kind of tool...
Good luck
Sebastien