Online Auction
The web based system which allows bidding for products
Prerequisite
- Java 1.8
- Apache Derby 10.13.1.1
- Apache Tomcat 8.5
- jstl-1.2.jar
- Log4J
Serving static files from local file system in Apache Tomcat
Seller can add product image. The images are saved on local file system of server outside of the WAR. Image name is saved in database corresponding to the product. Tomcat can be configured to read files from anywhere on disk and serve them on a specific URL.
Add the Context tag in the conf/server.xml file, docBase attribute is the absolute path to the folder on your local file system and path attribute will be used by Tomcat to access that folder. Make sure Tomcat has permissions to read/write the specified location.
<Host appBase=\"webapps\" autoDeploy=\"false\" name=\"localhost\" unpackWARs=\"true\" xmlNamespaceAware=\"false\" xmlValidation=\"false\"> ... <Context docBase=\"/Users/sanul/Documents/uploads/\" path=\"/media\" /> </Host>
For example, If I store myImage.jpg in /Users/sanul/Documents/uploads/ folder then using Tomcat server I can access that file in my browser using the following link
http://l**o*calhost:8080/media/myImage.jpg
Configure server.xml using Eclipse
- Go to Servers view.
- Double click Tomcat v8.5 Server at localhost.
- Click on the Modules tab.
- Select Add External Web Module.
- Enter Document Base as the path of folder you created and Path as /media.
Note : Create folder to upload images outside workspace.
Add Apache Derby database credentials
$ cd OnlineAuction/src/com/auctivity/utility
$ vim DBConnection.java
Add derby URL, username and password
con = DriverManager.getConnection(url,username,password);
Add Image upload path
$ cd OnlineAuction/src/com/auctivity/controller
$ vim AddProductController.java
Add BASE_DIR as the image upload folder path in doPost method
String BASE_DIR = \"/Users/sanul/Documents/\";
Create tables in database
Run the /OnlineAuction/AuctivitySchema.sql
Layered Architecture
.
├── AuctivitySchema.sql
├── WebContent
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── WEB-INF
│ │ ├── properties
│ │ │ └── log4j.properties
│ │ └── web.xml
│ ├── accounts
│ │ ├── login.jsp
│ │ ├── profile.jsp
│ │ └── registration.jsp
│ ├── buyer
│ │ └── buyerHistory.jsp
│ ├── common
│ │ ├── footer.jsp
│ │ └── navbar.jsp
│ ├── error
│ │ ├── comingSoon.jsp
│ │ ├── forbiddenAccessError.jsp
│ │ └── pageNotFoundError.jsp
│ ├── index.jsp
│ ├── resources
│ │ ├── css
│ │ │ ├── accounts
│ │ │ │ ├── login.css
│ │ │ │ ├── profile.css
│ │ │ │ └── registration.css
│ │ │ ├── buyer
│ │ │ │ └── buyerPagePurchasedProducts1.css
│ │ │ ├── home.css
│ │ │ ├── seller
│ │ │ │ ├── SellerNavbar.css
│ │ │ │ ├── SellerPage.css
│ │ │ │ └── addProducts.css
│ │ │ └── style.css
│ │ ├── img
│ │ │ └── logo.jpg
│ │ └── js
│ │ ├── accounts
│ │ │ ├── login.js
│ │ │ └── register.js
│ │ ├── buyer
│ │ ├── home.js
│ │ ├── index.js
│ │ ├── seller
│ │ │ ├── addProducts.js
│ │ │ └── scheduleAuction.js
│ │ └── utility
│ │ └── inputValidation.js
│ └── seller
│ ├── addProduct.jsp
│ ├── scheduleAuction.jsp
│ └── sellerHistory.jsp
├── derby.log
└── src
└── com
└── auctivity
├── controller
│ ├── AddProductController.java
│ ├── BuyerHistoryController.java
│ ├── DefaultController.java
│ ├── ExceptionController.java
│ ├── LogOutController.java
│ ├── LoginController.java
│ ├── ProfileController.java
│ ├── RegistrationController.java
│ ├── ScheduleAuctionController.java
│ └── SellerHistoryController.java
├── exceptions
│ ├── ForbiddenAccessException.java
│ ├── InsufficientBalanceException.java
│ ├── InvalidDataFormatException.java
│ └── UserNotFoundException.java
├── model
│ ├── beans
│ │ ├── Bid.java
│ │ ├── Category.java
│ │ ├── Product.java
│ │ ├── ProductForAuction.java
│ │ └── User.java
│ ├── dao
│ │ ├── IProductDao.java
│ │ ├── IProductSchedulerDao.java
│ │ ├── IUserDao.java
│ │ ├── ProductDaoImpl.java
│ │ ├── ProductSchedulerDaoImpl.java
│ │ └── UserDaoImpl.java
│ └── service
│ ├── IProductSchedulerService.java
│ ├── IProductService.java
│ ├── IUserService.java
│ ├── ProductSchedulerServiceImpl.java
│ ├── ProductServiceImpl.java
│ └── UserServiceImpl.java
└── utility
├── ContextListener.java
├── DBConnection.java
├── InputValidation.java
├── MyTimerTask.java
├── ObjectFactory.java
└── PasswordEncrypter.java
