I am learning how to create dynamic web applications in Java. I am having some trouble understanding how to connect the JSP files, XML files, and servlet together.
Here are files from my current project, which results in a 404 resource not found error
.
Servlet - Assumption: the servlet file needs no reference to the jsp or xml because I am formatting using a web.xml instead of annotations.
XML - Assumption A:
welcome-file tag
must connect to "fileName.jsp
". Assumption B:url-pattern tag
must contain "/nameOfJSPMinusFileExtension
"<servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/login</url-pattern> </servlet-mapping>
JSP - Assumption: the
action
property in theform
tag must contain "/nameOfJSPFile
"
The aforementioned configuration yields the following:
Could anyone explain the flow of these files and their annotations in terms of how they relate to one another to form the dynamic web app? I and others might benefit from understanding the relationship between the three.