I want to create a JSP page or servlet that will work in two ways.
The user views the page of his own profile:
HTTP // something.com / profile /
Or they visit their friends page:
http://something.com/profile/FriendsName
They can also visit their own page using an explicit URL, for example:
http://something.com/profile/YourName
I have a servlet mapping setup, as shown below, to map any requests / profile to my JSP that will handle this request.
<servlet>
<servlet-name>Profile</servlet-name>
<jsp-file>/profile.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>Profile</servlet-name>
<url-pattern>/profile</url-pattern>
</servlet-mapping>
, , URL- HTTPServletRequest /profile/.
<filter>
<filter-name>profile-filter</filter-name>
<filter-class>ProfileFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>profile-filter</filter-name>
<url-pattern>/profile*</url-pattern>
</filter-mapping>
HttpServletRequest, JSP, , , ?
bean ServletFilter, JSP jspBean :
<jsp:useBean id="profileInfo" scope="page" class="ProfileInfo" />