Properties file in servlet
what is properties file in servlets? explain its significance?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AartiRank #2,383 · 594 reputationPosted Nov 16, 2011, 7:12 PM EST
The Servlet Property File
Properties are stored in a text file with a default name of servlet.properties(You can specify it another name when you start ServletRunner.) The file holds the properties for all the servlets that servletrunner will run.
Here is the servlet.properties file for the Bookstore example:
# This file contains the properties for the Bookstore servlets.
servlet.bookstore.code=BookStoreServlet
# The servlet that manages the database of books
servlet.bookdb.code=database.BookDBServlet
# View all the books in the bookstore
servlet.catalog.code=CatalogServlet
# Show information about a specific book
servlet.bookdetails.code=BookDetailServlet
# See the books that you've chosen to buy
servlet.showcart.code=ShowCartServlet
# Collects information for buying the chosen books
servlet.cashier.code=CashierServlet
# Provide a receipt to the user who's bought books
servlet.receipt.code=ReceiptServlet
Thanks.
Priya LingeRank #785 · 2.9K reputationPosted Nov 16, 2011, 6:36 PM EST
ServletProperties: Gives the location of a file containing properties for your servlets.
The path can be absolute or relative to Apache's server root and, if not specified, defaults to
conf/servlets.properties
Many properties can be set within the properties file. Arguments can be passed to all servlets with the statement:
servlets.default.initArgs=arg1=val1,arg2=val2,...
Arguments can be passed to individual servlets as follows:
servlet.servletname.initArgs=arg1=val1,arg2=val2,...
The sixth and final step is to fire up Apache. Well, you should be ready to go at this point, so go into the /sbin directory of your Apache tree and start up the server:
cd /usr/local/apache/sbin
./apachectl start
Please check below link.
http://www.linuxjournal.com/article/3119
http://java.sun.com/developer/onlineTraining/Servlets/Fundamentals/servlets.html
Hope this will help you.
Thanks.
AartiRank #2,383 · 594 reputationPosted Nov 16, 2011, 7:30 PM EST
Please refer the below link.
http://tynamo.qindesign.com/docs/tini/props.html#servlet.propsFile
Regards
Aarti
Vikas MishraRank #559 · 4.3K reputationPosted Nov 18, 2011, 6:22 PM EST