Skip to content

Commit 92d7850

Browse files
committed
Tidy up project structure
1 parent 9148301 commit 92d7850

31 files changed

+37
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.project
55
.settings/
66
.vscode
7+
target

pom.xml

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
<project xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
45
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
56
<modelVersion>4.0.0</modelVersion>
67

7-
<groupId>org.mdb</groupId>
8-
<artifactId>DemoJSP</artifactId>
9-
<version>0.0.1-SNAPSHOT</version>
8+
<groupId>com.diffblue.pov</groupId>
9+
<artifactId>java-ee-servlet</artifactId>
10+
<version>1.0.0</version>
1011
<packaging>war</packaging>
1112

12-
<name>DemoJSP Maven Webapp</name>
13-
<!-- FIXME change it to the project's website -->
14-
<url>http://www.example.com</url>
13+
<name>Java EE Servlet Webapp</name>
14+
<url>http://localhost:4000</url>
1515

1616
<properties>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -21,56 +21,47 @@
2121

2222
<dependencies>
2323
<dependency>
24-
<groupId>javax.servlet</groupId>
25-
<artifactId>javax.servlet-api</artifactId>
26-
<version>4.0.1</version> <!-- Adjust based on your server (Tomcat 9+ supports 4.0) -->
27-
<scope>provided</scope>
24+
<groupId>javax.servlet</groupId>
25+
<artifactId>javax.servlet-api</artifactId>
26+
<version>4.0.1</version> <!-- Tomcat 9+ supports 4.0 -->
27+
<scope>provided</scope>
2828
</dependency>
29-
30-
<dependency>
31-
<groupId>javax.servlet</groupId>
32-
<artifactId>javax.servlet-api</artifactId>
33-
<version>4.0.1</version> <!-- Use version matching your server -->
34-
<scope>provided</scope>
35-
</dependency>
36-
37-
3829
<dependency>
3930
<groupId>junit</groupId>
4031
<artifactId>junit</artifactId>
4132
<version>4.13.1</version>
4233
<scope>test</scope>
4334
</dependency>
4435
<dependency>
45-
<groupId>com.mysql</groupId>
46-
<artifactId>mysql-connector-j</artifactId>
47-
<version>9.0.0</version>
48-
</dependency>
49-
50-
<dependency>
51-
<groupId>org.mockito</groupId>
52-
<artifactId>mockito-core</artifactId>
53-
<version>5.15.2</version>
54-
<scope>test</scope>
55-
</dependency>
56-
<dependency>
57-
<groupId>com.diffblue.cover</groupId>
58-
<artifactId>cover-annotations</artifactId>
59-
<version>1.3.0</version>
60-
<scope>test</scope>
61-
</dependency>
62-
36+
<groupId>com.mysql</groupId>
37+
<artifactId>mysql-connector-j</artifactId>
38+
<version>9.0.0</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.mockito</groupId>
42+
<artifactId>mockito-core</artifactId>
43+
<version>5.15.2</version>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>com.diffblue.cover</groupId>
48+
<artifactId>cover-annotations</artifactId>
49+
<version>1.3.0</version>
50+
<scope>test</scope>
51+
</dependency>
6352
</dependencies>
6453

6554
<build>
66-
<finalName>DemoJSP</finalName>
67-
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
55+
<finalName>DemoServlet</finalName>
56+
<pluginManagement>
57+
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
6858
<plugins>
6959
<plugin>
7060
<artifactId>maven-clean-plugin</artifactId>
7161
<version>3.4.0</version>
7262
</plugin>
73-
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
63+
<!-- see
64+
http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
7465
<plugin>
7566
<artifactId>maven-resources-plugin</artifactId>
7667
<version>3.3.1</version>
@@ -98,4 +89,4 @@
9889
</plugins>
9990
</pluginManagement>
10091
</build>
101-
</project>
92+
</project>
File renamed without changes.
File renamed without changes.

src/dao/UserDAO.java renamed to src/main/java/dao/UserDAO.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
import java.sql.PreparedStatement;
55
import java.sql.ResultSet;
66
import java.sql.SQLException;
7+
import java.sql.SQLIntegrityConstraintViolationException;
78
import java.util.ArrayList;
89

9-
import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException;
10-
1110
import model.User;
1211
import util.DBConnection;
1312

@@ -44,7 +43,7 @@ public String register(User user) {
4443
st.setString(4, user.getPassword());
4544
st.execute();
4645
return "Registration Successful.";
47-
} catch (MySQLIntegrityConstraintViolationException e) {
46+
} catch (SQLIntegrityConstraintViolationException e) {
4847
e.printStackTrace();
4948
return "Email alreay used.";
5049
} catch (SQLException e) {
@@ -123,7 +122,7 @@ public String updateProfile(User user) {
123122
st.setInt(4, user.getUser_id());
124123
st.execute();
125124
return "Profile Update Successful.";
126-
} catch (MySQLIntegrityConstraintViolationException e) {
125+
} catch (SQLIntegrityConstraintViolationException e) {
127126
e.printStackTrace();
128127
return "Email alreay used.";
129128
} catch (SQLException e) {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

target/DemoJSP.war

-3.92 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)