• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to deploy a servlet?

 
Angus Comber
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that I can simply copy my folder structure into the preferred place under the web container directory structure. Even better would be to create a WAR file. But in my web.xml file is some customer configuration string which would be part of the installation / pre-install stage. Eg a user would be prompted for x and then the web.xml file would be updated.

How would I handle this? Is this the way:

1. prompt installer for string.
2. run command line function to update war file.
3. copy war file to web container correct folder.

Is a batch file typically used to do this? Anyone got links to any samples?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
410
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any reason you can't refactor your code to NOT have customer specific information in the web.xml? You could put it in a property file or an app server variable or an operating system variable.

If it absolutely must be in the web.xml, you could write a script to unjar the war file, update the web.xml and jar it back up. But this is awkward. And it would be easier to update the app to not have a web.xml dependency that is user dependent.
 
Angus Comber
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does it matter if it is in web.xml or some other file. at the end of the day, to deploy it, the installer is going to have to enter some information. How does it matter what file it goes in. I don't really understand your logic there?


Jeanne Boyarsky wrote:Is there any reason you can't refactor your code to NOT have customer specific information in the web.xml? You could put it in a property file or an app server variable or an operating system variable.

If it absolutely must be in the web.xml, you could write a script to unjar the war file, update the web.xml and jar it back up. But this is awkward. And it would be easier to update the app to not have a web.xml dependency that is user dependent.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
410
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angus Comber wrote:How does it matter if it is in web.xml or some other file. at the end of the day, to deploy it, the installer is going to have to enter some information. How does it matter what file it goes in. I don't really understand your logic there?

It matters because if the file is outside your war, you don't need to be changing the war. You always have the deployer deploy the SAME war file and enter the information "elsewhere."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!