Why the link clicked by <a href= "- sharp" > is not the current page, but the project root directory followed by-sharp

question: I wrote a login hyperlink href= "- sharp" on http://localhost:8080/ssm0702/user/getUsers. I thought he would jump to the current page, but it jumped to http://localhost:8080/ssm0702/-sharp.
Screenshot:

Page Code:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP "allUsers.jsp" starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
  
  <body>
      <c:if test="${uname==null }"><a href="-sharp"></a></c:if>
      <c:if test="${uname!=null }">${uname }</c:if>
      <c:if test="${uname!=null }"><a href="<%=basePath %>user/loginout"></a></c:if>
    <center>
        <h1></h1>
        <table border="1">
            <tr>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <c:forEach items="${users }" var="d">
                <tr>
                    <td><a href="-sharp">${d.userid }</a></td>
                    <td>${d.username }</td>
                    <td><img alt="${d.pwd}" src="img/${d.pwd}"></td>
                </tr>
            </c:forEach>
        </table>
    </center>
  </body>
</html>
May.10,2021

< base href= "<% = basePath% >" >


you set up base. for your page

<base href="<%=basePath%>">

but with or without base, pages will end up with-sharp, which is a standard-defined behavior. Based on your needs, you can do this

<a href="javascript:void(0)"></a>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cb0b-2c348.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cb0b-2c348.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?