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>