Hoyeon's bbs

Project: Forum

Development environment

Project summary

Detailed introduction to the project

Front-end technology

1. Sign up

Users can sign up by agreeing to the membership terms and conditions.

2. Login

Users can log in with the ID and password they created during membership registration.

3. Home

Users can view a categorized list of forum.

4. Create a forum

By writing a post, users can attach files and enter basic information.

5. View forum

Users can view the details of the articles they wrote and also view comments.

6. Forum modification

Users can change information related to the forum.

7. Delete forum

Users can delete a forum by entering the password they used when creating it.

Backend technology

1. Find ID/Password

Implemented using Ajax communication through JQuery

Data is exchanged through asynchronous communication, and the value is successfully retrieved and output.

2. Upload files

Added enctype option to form tag for file upload function.

Saved the location where the file to be uploaded is stored as dir, retrieved the data using MultipartRequest, and saved it in a variable.

Inserted files and information to be uploaded through DB connection and DAO.

3. Increase views

Used Cookies and JSTL

When the num and cookie values ​​of the current post are not the same, the cookie value is set to the num value of the current post and the count is increased by 1 to increase the number of views.

4. Paging implementation

Used DTO and DAO to retrieve data and implemented it in list.jsp.

Set default values ​​for paging.

Limited the number of records to be loaded from the database at one time.

Set the current page and total number of records in the paging class, which is a DTO, and used DAO to store the necessary values ​​in a list.

Implemented paging in List.jsp.

Users can find related posts by title, author, or content.

Created an input value sent to list.jsp within the Form tag.

Used JQuery to store the search method in the input value to be transmitted.

Declared variables col and val and stored the values ​​of colname and values ​​sent from the form tag.

Added two parameters, col and val, to the paging method implemented above and searched the database values ​​according to the conditions of the switch statement.

Users can see the number of posts related to the search content and the output and paging.

6. Implementation of comment function

Users can register, edit, or delete comments by passing values ​​through Ajax asynchronous communication.

The values ​​to be transmitted within the form tag are stored in $form and communicated.

A Java library for processing JSON data is imported as a Bean. Entered the result value according to the comment function and changed the JSON object to string data.

Depending on the input value received through Ajax, comments can be created, modified, or deleted, and each function can be performed..

7. Reply function

By modifying the DAO, the method of insertion into the DB is different depending on the presence or absence of the id value coming in as a parameter.

When there is an ID value, a reply is written to the post being viewed. In this case, orN contains the value of the post to which the original reply was intended, and grN and lyN have values ​​incremented by 1 from the original post’s value. If there were other replies to the original post, grN > ? All grNs are increased by 1 through conditions to prevent ordering problems. If there is no ID value, a new post is created. Because it is a new post that is not connected to existing posts, a new post is created by finding the Max of orN and increasing it by 1.

In order to output posts and replies to posts in order, the query statement for paging must be modified.

When printing, in order to distinguish posts from replies to posts, replies were separated by an empty space at the front if grN was greater than the original value of 0. Replies to replies are separated by the value of lyN and were given more empty space than the reply. For a clean design of the post, the number of replies to a reply was limited to a maximum of two.

Print a reply to a post.

View source code

Link here