summaryrefslogtreecommitdiff
path: root/maven/03-hello2-form-submission-webapp/README
blob: 015d62fcef346eb050c44c4d771126272f425a8c (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
This webapp shows how a servlet is used to process a form submission.

Command to generate this webapp from Maven archetype:

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/.