<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.io.File"%> <% StringBuilder path = new StringBuilder("/helpfiles/"); //servlet mapping assures pathInfo[0] == help //expect pathinfo /help// String pathInfo[] = (request.getPathInfo() != null) ? request .getPathInfo().split("/") : new String[] {}; if (pathInfo.length < 2) { path.append("index.html"); } else { String language = "de"; if (pathInfo.length > 2 && (new File("/helpfiles/" + pathInfo[1].split("_")[0].toLowerCase())).isDirectory()) { language = pathInfo[1].split("_")[0]; } path.append(language); path.append('/'); String filename = pathInfo[(pathInfo.length > 2) ? 2 : 1]; path.append(filename); } System.out.println(path); %>