Create a Web Application that allows a user to upload a CSV file. The CSV file should contain the following fields : [ Name, Email, Phone Number].
- Store the data received from the CSV file into a MYSQL database. Read and render/display the stored data on a webpage.
- Technology: JSP, Servlet and MySQL.
csvWeb is a Java web application built for the JSP community that has two primary goals:
- Allow user to upload CSV file and further store the same into MYSQL database.
- Read and display the data stored on webpage.
- JAVA Servlet
- JSP
- MYSQL
- JQUERY
-
Clone the repository from GitHub:
$ git clone https://github.com/seemantshekhar43/fossee-task.git
-
Create table in your database to store data :
mysql> create table data(name text null, email text null, phone text null);
-
Open downloaded project(task1/csvWeb) in IntelliJ/ Eclipse.
-
Make the following changes in upload_page.jsp and display.jsp:
- Replace YOUR_DB_NAME with name of your database
- Replace USERNAME with username of MYSQL database
- Replace PASSWORD with password of MYSQL database
In upload_page.jsp
Class.forName("com.mysql.jdbc.Driver"); String connectionURL = "jdbc:mysql://localhost:3306/YOUR_DB_NAME"; con = DriverManager.getConnection connectionURL, "USERNAME", "PASSWORD");
In display.jsp
String driverName = "com.mysql.jdbc.Driver"; String connectionUrl = "jdbc:mysql://localhost:3306/"; String dbName = "YOUR_DB_NAME"; String userId = "USERNAME"; String password = "PASSWORD";
-
Build the project and Run on Tomcat server.
-
If you have opened the project in IntelliJ then you can view the app at: http://localhost:8080/csvWeb_war_exploded/
-
I have included a demo csv file for testing named "demoData.csv".
Create a Traveller blog application. An example format of the webpage has been shown below:
Do the following validations on the page:
-
Date: Form should not accept date greater than the current date.
-
Image: The image file must be JPEG/JPG/PNG format only and the size of the file should not exceed 5 MB.
-
Allow only 100 characters for the Name field.
-
Display all blogs in descending order (based on the date of creation) in a page.
-
Give all users View/Edit/Delete option for each blog.
-
Note: The image should be stored in a directory and the relative path of the image should be stored in the database.
-
Technology: Spring boot, Hibernate, Mysql, Thymeleaf, BootStrap, CSS.
Traveller's Blog is a Java web application built for the Spring community. This is blogging site having basic blogger features for travellers.
- Create Account
- Login/Logout
- Add new Post (Can add image to the post too.)
- Display Post
- Edit Post
- Delete Post
- JAVA
- Spring MVC
- Spring Boot
- JPA
- Hibernate
- Thymeleaf
- JQUERY
- Bootstrap
- MYSQL
-
Clone the repository from GitHub:
$ git clone https://github.com/seemantshekhar43/fossee-task.git
-
Open project (task2/tblog) in IntelliJ/Eclipse.
-
Make the following changes in application.properties:
- Replace YOUR_DB_NAME with name of your database
- Replace USERNAME with username of MYSQL database
- Replace PASSWORD with password of MYSQL database
application.properties
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver spring.datasource.url = jdbc:mysql://localhost:3306/YOUR_DB_NAME?characterEncoding=utf8 spring.datasource.username = USERNAME spring.datasource.password = PASSWORD
NOTE: Change the values for "spring.jpa.hibernate.ddl-auto"
- If you are running for the first time.
spring.jpa.hibernate.ddl-auto = create
- If you are running for the 2nd time or else.
spring.jpa.hibernate.ddl-auto = update
-
Make the following changes in PostService.java
- Update the absolute path of "media" in accordance with where you cloned the project.
final static String POST_IMAGE_PATH = "absolute_path_of_media_folder";
- Example: if you have cloned fossee-task on your desktop, then the absolute path will be: "/home/pc_name/Desktop/fossee-task/task-2/tblog/media/";
-
Build the project and run on Tomcat server (just run and do nothing ).
-
Now make the following changes in application.properties (change the value to update)
spring.jpa.hibernate.ddl-auto = update
-
Build and Re-run the porject.
-
You can view your blog at: http://localhost:8080/
-
To add new post you need to be logged in. So register first.
-
Create an account using Register tab.
-
One can view/edit/delete without logging in.
-
Happy Blogging!!