| Author |
In which package should be a Listener
|
Pranav Pal
Ranch Hand
Joined: Nov 04, 2007
Posts: 74
|
|
Hello.. I am using MVC for my web-app. I have two packages: (1)myPackage.web : Package for Controller classes (Servlets) (2)myPackage.model : Package for Model classes (Helper classes) Now I want to add a ServletContextListener class in my app. In which package should I put it? Thanks in advance..
|
Hakuna Matata!
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
|
|
|
Is it part of the model?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Pranav Pal
Ranch Hand
Joined: Nov 04, 2007
Posts: 74
|
|
Originally posted by Bear Bibeault: Is it part of the model?
The Listener is used to get Data Source Name from context-init-parameters and to get a Connection using that Data Source Name, which can be used by Model classes afterwards
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
|
|
|
Your model should be compeltely independent of the user interface. In other words, if you chose to put a Swing UI on your application, would the listener class still be a useful part of the model?
|
 |
Pranav Pal
Ranch Hand
Joined: Nov 04, 2007
Posts: 74
|
|
Sorry, Bear I didn't get your answer.. Can you elaborate it? Thanks in advance...
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Bear Bibeault: Your model should be completely independent of the user interface. ...
In your case the user interface (UI) is a servlet application. ServletListeners are part of the servlet spec and part of the javax.servlet. API. Would your model package be independent of the UI if it contained classes that need to import javax.servlet classes?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: In which package should be a Listener
|
|
|