Joe Ess wrote:Note that the namespace in the form (line 1) and the namespace in struts.xml (line 4) do not match.
You need to declare the namespace in your package declaration.
Joe Ess wrote:Note that the namespace in the form (line 1) and the namespace in struts.xml (line 4) do not match.
You need to declare the namespace in your package declaration.
Joe Ess wrote:
Pramod Kumar Pandey wrote: Should I set classpath in environment variable , by providing all jar's name separated by commas .
Absolutely not. It is hard to parse out in the link Campbell gave you, but it states:
In J2EE development, you should generally not modify the CLASSPATH or put application jars (except JDBC drivers) in the lib directories of your application server or jre/lib/ext. Doing so may introduce odd dependencies between your web applications and set you up for classloader problems.
We should deal solely with the contents of WEB-INF/lib. Again, what JAR files have you placed there?
Campbell Ritchie wrote:Is that a system classpath or a classpath local to your current app? You should only use specific classpaths, not a system classpath.
That classpath is also obviously wrong, so you cannot load that particular .jar. Look at this FAQ about classpaths.
Campbell Ritchie wrote:Please show us the location of those Struts .jars and the CLASSPATH you are using.
Henry Wong wrote:
Pramod Kumar Pandey wrote:
I surfed on net, and I got your point. Thank you so much SIR. One more question -> why ArrayList or other classes doesn't use hashing , because our sole purpose is to improve performance of the collection.
Not all algorithms will work in all cases. For example, lists are ordered -- can you think of a way to do hashing *and* keep ordering?
Also, not all algorithms are best for everything. This is why there is an array list and a linked list.
Henry
Pramod Kumar Pandey wrote:
Henry Wong wrote:
Pramod Kumar Pandey wrote:Actually when hashCode() is called ?
Well, it is an implementation detail of the hashing collections... but generally, after a hashing is done to determine the bucket, the equals() method is called to compare it to other elements in the same bucket. So, if there is not other element in the bucket, then the equals() method may not be called at all.
Pramod Kumar Pandey wrote:Sir I am really confused , when hashCode() is called ? if we are overriding hashCode, at the time of constructor calling it is called, but how ? And for being two object equal their hashCode value must be same , and equals should return true, but if we are overriding hashCode only not equals then .... when we add those two object to a hashSet collection, hashCode() is called and then equals will be called but actually we didn't override equals in our class so Object's equals will be called which again checks for hashCode which is same , but both are added to a not duplicable collection. Please help me
The Object class equals() method does not compare hash codes. It just checks to confirm that it is the exact same object (same as using the == comparison operator).
Henry
Sir Henry till now I just read that by default the Object's equals() uses == which means checking hashCode(also called deep comparison) ? then if two object having same code should be meaningfully equivalent.
Henry Wong wrote:
Pramod Kumar Pandey wrote:Actually when hashCode() is called ?
Well, it is an implementation detail of the hashing collections... but generally, after a hashing is done to determine the bucket, the equals() method is called to compare it to other elements in the same bucket. So, if there is not other element in the bucket, then the equals() method may not be called at all.
Pramod Kumar Pandey wrote:Sir I am really confused , when hashCode() is called ? if we are overriding hashCode, at the time of constructor calling it is called, but how ? And for being two object equal their hashCode value must be same , and equals should return true, but if we are overriding hashCode only not equals then .... when we add those two object to a hashSet collection, hashCode() is called and then equals will be called but actually we didn't override equals in our class so Object's equals will be called which again checks for hashCode which is same , but both are added to a not duplicable collection. Please help me
The Object class equals() method does not compare hash codes. It just checks to confirm that it is the exact same object (same as using the == comparison operator).
Henry
Joanne Neal wrote:
Pramod Kumar Pandey wrote:Sir but when we are not creating the child object then how it will call the Child constructor ?
You may not be creating a Child instance in this particular piece of code but there may be other code in other files that does create a Child instance.
After all, what's the point of defining the Child class if you're never going to create an instance of it (or a subclass of it) ?
Joanne Neal wrote:
Pramod Kumar Pandey wrote:we are not creating child consttructor.
Yes you are - on lines 12 - 14.
The problem is that the compiler automatically adds a call to a no-arg parent class constructor in any constructor that doesn't explicitly call a parent constructor or an overloaded constructor. But your parent class doesn't have a no-arg constructor, so you get an error.