jose chiramal wrote:In java any method has to be called using an object unless it is a static method which can be called directly or using class name. In this case saveErrors() is not static, how are we able to call saveErrors(request,errors) directly without using any object is my question.
Java 101. Please, please go back to the basics before considering doing much else, otherwise almost all code is going to look very confusing to you.
See
Foo.baz()? It calls
bar().
bar() is an instance method of class
Foo that can be called by "any" other (non-static) method of
Foo.
A
Struts 1 action is an instance of class
Action. Your action is a subclass of
Action. Your action methods can call other methods of your action--or methods contained in its superclass... which is
Action.
There's an implicit
this in front of instance method calls within an instance.
saveErrors(...) is an instance method of an
Action. Essentially every single non-trivial Java class will call instance methods like this--it's almost impossible you haven't seen this before.