So, I've in fact more or less solved the problem. The solution confuses me however, so if anyone can help me understand, I would very much appreciate it.
My
jsp forwards to an action class which calls a class that does the database access. The database access class returns the result to the action class. The action class populates a bean with the results and sets a request attribute with the bean. Finally it forwards back to the jsp, which displays the results from the bean. As you can tell, it's a tiny web-app at this point, but I believe it is structured properly (if you have different information about where the db access should happen, please let me know, I really want this app to be structured to the standards).
The thing that I got hung up on was accessing the application scope attributes (from the ServletContext) in the database access method. I'll post it here:
As I said, I'm calling this class and its one method rather than forwarding to it. As such, I think it's not being passed the ServletContext unless I do it explicitly(as I do). This is what confuses me. I assumed that because the ServletContext was application scope that it would automatically be available in any class I called in my web-app. I guess that was a poor assumption. Can anyone explain what I'm missing here? There's some bit of theory that hasn't gotten through to me and I'd really appreciate it if someone could explain briefly.
Thanks, Trevar