<servlet>
<servlet-name>display.jsp</servlet-name>
<jsp-file>/display.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>display.jsp</servlet-name>
<url-pattern>/display/*</url-pattern>
</servlet-mapping>
- servlet 内で servlet-class だけでなく jsp-file が使える
<%@ import="java.util.regex.Pattern" import="java.util.regex.Matcher"%>
Pattern p = Pattern.compile("/tomcat_context/display/([^/]+)/([^/]+).html");
Matcher m = p.matcher(request.getRequestURI());
if (m.matches()) {
p1=m.group(1);
pw=m.group(2);
} else {
p1="";
pw="";
}