Pramod Kumar Pandey

Ranch Hand
+ Follow
since Dec 05, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Pramod Kumar Pandey

Hi All,

Could anyone help me ?

Actually I want when I shut down my Server, I want to write some value to database. This functionality can be achieved by destroy() function in Servlet. I don't know , how implement this functionality while using Struts2 framework. Please Help me. Thanks in advance.
10 years ago

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 Sir if we are not using namespace then what is the need of declare namespace . By the way I declared namespace attribute in form tag with the same
literal value as namespace have in package tag. but it is still showing that HTTP Status 404 - There is no Action mapped for namespace / and action name user.

index page code :



and struts.xml has code :



Once I was confused that in form tag namespace literal value should start with / or not but both are tested , not working. Joe Sir please help me, error is in code or IDE ? SIR.
10 years ago

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.



10 years ago

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?



Dear Sir, this helped me lot. but now this error is showing :
Some days ago this error was occured and didn't get resolved, when I googled I found they are saying that look at your Action class name. but that is correct.


while I defined action named "pramod" in struts.xml :



What does it mean.? Sometimes it runs without any problem and same code sometimes shows this error, is there no reliability of eclipse IDE ? Sir How you get the reason for that stack trace ...
. because there is very large LOC . When I'll able to trace that reasons.
10 years ago

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.



Sir, Should I set classpath in environment variable , by providing all jar's name separated by commas .? Sir please guide me because this forum is only my teacher.
I think you will get my problem.
10 years ago

Campbell Ritchie wrote:Please show us the location of those Struts .jars and the CLASSPATH you are using.




Sir, The classpath is as follows :

C:\Users\pramod\workspace1\Second\build\classes

And location of strus2.jars is :

C:\Users\pramod\workspace1\Second\WebContent\WEB-INF\lib
10 years ago
Sir I pasted all struts2 jar file in build path of my project and in the lib folder under WEB-INF , but It is showing HTTP 404-/ProjectName/ Showing stack trace as follows :
Is there any side effect of adding all strust2 jar needed in our project, because I am not able to recognize which selected jar should be added , so I added all jars use for struts2.
At some sites I found they say should not add extra jars if you are not using, Are they correct ?


Please help me.
10 years ago
I've pasted all jar files required (perhaps) but still facing this problem in eclipse IDE.
I googled this but didn't get solution. So please help me SIR.
10 years ago

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


Thanks Sir !
10 years ago

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.


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.
10 years ago

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.
10 years ago
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
10 years ago

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) ?




Thank you SIR !

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.



Sir but when we are not creating the child object then how it will call the Child constructor ?

problem : It's asking about Parent() constructor, I am not getting where is the problem because we are not calling child consttructor.