Java jsp不能在所有浏览器上正常工作
我已经开发了一个简单的登录应用程序。我已将login.jsp页面重定向到admin.jsp,其中有我的注销URL和欢迎管理员标题。当我在默认浏览器中运行项目时,它工作正常 但当我复制URL并将其粘贴到另一个浏览器中时,它不会显示注销URL和标题。我已经将admin.jsp代码包含在本文中Java jsp不能在所有浏览器上正常工作,java,tomcat,Java,Tomcat,我已经开发了一个简单的登录应用程序。我已将login.jsp页面重定向到admin.jsp,其中有我的注销URL和欢迎管理员标题。当我在默认浏览器中运行项目时,它工作正常 但当我复制URL并将其粘贴到另一个浏览器中时,它不会显示注销URL和标题。我已经将admin.jsp代码包含在本文中 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@page session="true"%> <!
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page session="true"%>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin Page</title>
<meta charset="utf-8">
<link rel="stylesheet"
href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$("#from").datepicker({
defaultDate : "+1w",
changeMonth : true,
numberOfMonths : 1,
onClose : function(selectedDate) {
$("#to").datepicker("option", "minDate", selectedDate);
}
});
$("#to").datepicker({
defaultDate : "+1w",
changeMonth : true,
numberOfMonths : 1,
onClose : function(selectedDate) {
$("#from").datepicker("option", "maxDate", selectedDate);
}
});
});
</script>
</head>
<body bgcolor="grey">
<%-- <h1>Title : ${title}</h1>
<h1>Message : ${message}</h1> --%>
<c:url value="/logout" var="logoutUrl" />
<form action="${logoutUrl}" method="post" id="logoutForm">
<input type="hidden" name="${_csrf.parameterName}"
value="${_csrf.token}" />
</form>
<script>
function formSubmit() {
document.getElementById("logoutForm").submit();
}
</script>
<c:if test="${pageContext.request.userPrincipal.name != null}">
<h2>
Welcome : ${pageContext.request.userPrincipal.name} | <a
href="javascript:formSubmit()"> Logout</a>
</h2>
</c:if>
<label for="from">Start_Date : </label>
<input type="text" id="from" name="from">
<br>
<br>
<label for="to">End_Date : </label>
<input type="text" id="to" name="to">
<form name='loginForm' action="<c:url value='/admin' />" method='POST'>
<table>
<tr align="center">
<td colspan='2'><input name="submit" type="submit"
value="submit" /></td>
</tr>
</table>
<input type="hidden" name="${_csrf.parameterName}"
value="${_csrf.token}" />
</form>
</body>
</html>
管理页面
$(函数(){
$(“#from”).datepicker({
默认日期:“+1w”,
变化月:对,
月数:1,
onClose:函数(selectedDate){
$(“#至”).datepicker(“选项”,“minDate”,selectedDate);
}
});
$(“#到”)。日期选择器({
默认日期:“+1w”,
变化月:对,
月数:1,
onClose:函数(selectedDate){
$(“#from”).datepicker(“选项”,“maxDate”,selectedDate);
}
});
});
函数formSubmit(){
document.getElementById(“logoutForm”).submit();
}
欢迎:${pageContext.request.userPrincipal.name}|
开始日期:
结束日期:
除了那些注销url和欢迎管理员之外,它还会抛出任何例外……管理员页面中的所有内容都会在不同的浏览器中显示。有人能帮我吗…为什么它不在浏览器中显示这些东西。请尽快回复。提前感谢。不,它不会抛出任何异常@Saurabh Jhunjunwalawelcome admin |注销开始日期,结束日期,仅提交开始日期,结束日期,提交仅在默认浏览器以外的浏览器中显示。我猜pageContext.request.userPrincipal.name为null-执行一些服务器端调试以找出未设置它的原因。