summaryrefslogtreecommitdiff
path: root/maven/03-hello2-form-submission-webapp/README
blob: 40ea4b3e1c4c2a80d70103168c0e24b03a4e1b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
This webapp shows how a servlet is used to process a form submission.

Command to generate this webapp from Maven archetype:

Linux:
mvn archetype:generate -DgroupId=com.example.servletapp \
  -DartifactId=hello2 \
  -DarchetypeArtifactId=maven-archetype-webapp \
  -DinteractiveMode=false

Windows:
mvn archetype:generate "-DgroupId=com.example.servletapp" ^
  "-DartifactId=hello2" ^
  "-DarchetypeArtifactId=maven-archetype-webapp" ^
  "-DinteractiveMode=false"

Open the project inside the IDE (like Visual Studio Code).

Update the pom.xml file to the one provided here.

Create directory src/main/java .

Create a new package (say lk.ac.pdn.ceit.hello).

Create a new Java class (name it PostExampleServlet).

Complete the Java class (look at the given PostExampleServlet.java file).

Replace the content of src/main/webapp/index.jsp with the one provided.

Build the project:

  mvn clean package

Deploy the generated hello2.war to Tomcat and access it via http://localhost:8080/hello2/.