Cutting the nonsense and going straight to the code is the best way for programmers to communicate haha:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath( );
String basePath = request.getScheme() "://" request.getServerName() ":" request.getServerPort() path "/";
%>
My JSP 'index.jsp' starting page
The effect is as follows: