How URLs Are Interpreted
One thing that can be confusing in a JSP-based application is the different types of URIs used in the HTML and JSP elements. The confusion stems from a combination of conflicting terms used to describe URIs in the HTTP, servlet, and JSP specifications, as well as the fact that some types of URIs are interpreted differently in the HTML and the servlet world.
In HTML, URIs are used as attribute values in elements like
<a>, <img>, and
<form>. JSP elements that use URI attribute
values are the page, include,
and taglib directives and the
<jsp:forward> and
<jsp:include> actions. Custom actions can
also define attributes that take URI values.
The HTTP/1.1 specification (RFC 2616, with more details in RFC 2396)
defines a Uniform Resource Identifier (URI) as a string, following
certain rules, that uniquely identifies a resource of some kind. A
Uniform Resource Locator (URL) is just a special kind of URI that
includes a location (such as the server name in an HTTP URL). An
absolute URI is a URI that starts with the name
of a so called scheme, such as http or
https, followed by a colon (:)
and the rest of the resource identifier. An example of an absolute
URI for a resource accessed through the HTTP protocol is:
http://localhost:8080/ora/ch12/login.jsp
Here, http is the scheme,
localhost:8080 is the location (a server name and
a port number), and /ora/ch12/login.jsp is the
path.
The URIs used in the HTML elements generated by a JSP page are interpreted by the browser. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access