we are 3 in the team and working in one project. We find it difficult to maintain the web.xml when clubbing all our modules. so i was thinkig if there was a way to load external xml file, we could use 3 individual xml files during development and while deploying
we can put everything into web.xml
This might(should) sound silly
is there any other better option.
Joined: Mar 22, 2005
The web.xml file should't be something that changes very frequently. Are you maybe keeping configuration parameters in it that would better be kept in a configuration file (like a properties file)?
Ramkumar Subburaj wrote:
Please tell whether the following configuration is right?
I am getting resource not found error when i access the servlet directly.
Of course, because this is incorrect:
if you have applicationContextTest in application/config/, for example, you put <param-value>config/applicationContextText.xml<param-value/>
Joined: Sep 07, 2007
what does this mean
if you have applicationContextTest in application/config/
i believe application/config/ is a path and what does this point to
Joined: May 07, 2008
Where you put the other xml files that you want web.xml to load. I usually keep them in a config folder in the application along with other xml and properties files, but you can put them in any folder in your application. So the param-value should point to their location.
Joined: Oct 08, 2006
To clear things out, using context-param doesn't load the specified xml file automagically into the web.xml or so. It only make the name available as ServletContext#getInitParameter() so that one could use this information to load the xml file programmatically or so. I have no idea what Nick is thinking or (mis)understanding, but this is really not what you're looking for.
I usually put all my servlets in a servlet.xml instead of web.xml, so when the application is loaded it reads the servlet.xml file. I do this using param-values. I assume he wants to do something similar? If i'm doing something wrong (or misunderstand something), what is that?
Joined: Mar 22, 2005
Bauke Scholtz wrote:using context-param doesn't load the specified xml file automagically into the web.xml
Not in a standard servlet container, but the Spring framework can be configured to work this way. That may be what's being talked about here.
This is creating a lot of confusion.
Did you write a custom clasloader that reads the external xml files and loads the servlet classes?
If not, what container are you using?
There is nothing in the servlet spec that allows external xml files to be automatically loaded.
If your container is doing this then it is probably non spec feature provided by that container.
To avoid this type of confusion we try to keep the conversation here to features provided by the servlet specification so the answers given will work for people using any spec compliant container. If you want to discuss a container specific feature, please let everyone know what container you're using and that your answer applies only to that container.