This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
} return connection; } } But on my jsp i am gettign the error: non-static method getConnection() cannot be referenced from a static context. Why woudl I have to make getConnection() static. I coudl have sworw I have done something like this before w/o having to make anything static. Is it becasue I have member variables and the last time that I did this I did not?
This is a pretty basic Java concept. A reference of type ClassName.myMethod() is a static reference. For it to work, myMethod must be static. To call instance (non-static) methods, you need an instance of the class. For example:
or some such. I'm going to shuffle this off to Java in General (beginner) for any further discussion since it's really nothing to do with JSPs. bear