有三四个页面,页面开头部分是一个判断要不要转到这个页面的代码。1.如果不符合跳转的条件,其中几个都能正确判断,会弹出一个对话框。唯独有一个页面不弹对话框,而是直接报错。2.如果符合跳转的条件,那个页面就能正常显示了。出错页面代码如下:(其中html之前是我所说的前面相同的判断代码)<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/Common.jsp"%>
<%@ include file="/Check.jsp"%>
<%
String username = (String) session.getValue("UserName");
if(!Employee.IsExist(username))
{ %>
<script>
alert("您还没有添加过基本资料,请先添加!");
window.history.back();
</script>
<% }
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<title><%=title%></title>
<link rel="stylesheet" href="/PersonManage/css/style.css"
type="text/css" media="screen">
<script type="text/javascript"
src="/PersonManage/datePicker/WdatePicker.js"></script>
<script Language="JavaScript">
function check_input(theForm)
{
if (theForm.employeeid.value.length != 8)
{
alert("职工编号必须为8位。");
theForm.employeeid.focus();
return (false);
}
if (theForm.username.value == "")
{
alert("请输入姓名。");
theForm.username.focus();
return (false);
}
}
</script> </head>
<%@ include file="../incoming/Header.jsp"%>
<%
String id = (String) session.getValue("UserName");
String employeeid = new String(id.getBytes("ISO8859_1"), "UTF-8");
Employee employee = Employee.FindByID(employeeid);
%>
<table width="780" border="0" align="center" cellpadding="0"
cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="120" valign="top" background="../images/in_left_bg.gif"><%@ include
file="EmployeeLeft.jsp"%></td>
<td width="660" align="center">
<p align="center" class="title1">
修改基本资料
</p>
<form name="form1" method="post" action="ModifyEmployeeStep2.jsp"
onsubmit="return check_input(this)"><TABLE border=0 cellSpacing=1 cellPadding=0 width=640 height="513"
bgColor=#dedee9 align=center>
<TD width=92 align=middle>性别</TD>
<TD colSpan=2>
<%if (employee.getSex().equals("男")) {%>
<INPUT type="radio" name="sex" value="男" checked>
男<%
} else {
%>
<INPUT type="radio" name="sex" value="男">
男<%}%>
<%if (employee.getSex().equals("女")) {%>
<INPUT type="radio" name="sex" value="女" checked>
女<%
} else {
%>
<INPUT type="radio" name="sex" value="女">
女<%
}
%>
</TD>
</Table>
</form>
</td>
</tr>
</table>
<%@ include file="../incoming/Footer.jsp"%>
</body>
</html>代码我经过了简化,其中,如果把红色代码删除,就不会出现问题了,难道红色部分代码和前面几行发生了冲突??怎么解决??
<%@ include file="/Common.jsp"%>
<%@ include file="/Check.jsp"%>
<%
String username = (String) session.getValue("UserName");
if(!Employee.IsExist(username))
{ %>
<script>
alert("您还没有添加过基本资料,请先添加!");
window.history.back();
</script>
<% }
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<title><%=title%></title>
<link rel="stylesheet" href="/PersonManage/css/style.css"
type="text/css" media="screen">
<script type="text/javascript"
src="/PersonManage/datePicker/WdatePicker.js"></script>
<script Language="JavaScript">
function check_input(theForm)
{
if (theForm.employeeid.value.length != 8)
{
alert("职工编号必须为8位。");
theForm.employeeid.focus();
return (false);
}
if (theForm.username.value == "")
{
alert("请输入姓名。");
theForm.username.focus();
return (false);
}
}
</script> </head>
<%@ include file="../incoming/Header.jsp"%>
<%
String id = (String) session.getValue("UserName");
String employeeid = new String(id.getBytes("ISO8859_1"), "UTF-8");
Employee employee = Employee.FindByID(employeeid);
%>
<table width="780" border="0" align="center" cellpadding="0"
cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="120" valign="top" background="../images/in_left_bg.gif"><%@ include
file="EmployeeLeft.jsp"%></td>
<td width="660" align="center">
<p align="center" class="title1">
修改基本资料
</p>
<form name="form1" method="post" action="ModifyEmployeeStep2.jsp"
onsubmit="return check_input(this)"><TABLE border=0 cellSpacing=1 cellPadding=0 width=640 height="513"
bgColor=#dedee9 align=center>
<TD width=92 align=middle>性别</TD>
<TD colSpan=2>
<%if (employee.getSex().equals("男")) {%>
<INPUT type="radio" name="sex" value="男" checked>
男<%
} else {
%>
<INPUT type="radio" name="sex" value="男">
男<%}%>
<%if (employee.getSex().equals("女")) {%>
<INPUT type="radio" name="sex" value="女" checked>
女<%
} else {
%>
<INPUT type="radio" name="sex" value="女">
女<%
}
%>
</TD>
</Table>
</form>
</td>
</tr>
</table>
<%@ include file="../incoming/Footer.jsp"%>
</body>
</html>代码我经过了简化,其中,如果把红色代码删除,就不会出现问题了,难道红色部分代码和前面几行发生了冲突??怎么解决??
解决方案 »
- 一个网址不加 www 是啥意思? 例如: sina.com 与 www.sina.com
- 如何做一个退出网页的按钮?
- vista中tomcat不能使用
- 如何将输出的内容设置为超连接?
- 多页面的值传递问题
- 推荐一个国内开源Java Web框架
- 我该怎样插入图片啊?
- Servlet 的doGet doPost 问题!
- 这是论坛一个页面源代码,但总出现异常Page directive: can't have multiple occurrences of language
- resin环境下,为什么不能访问中文名称的磁盘文件,哪位能给解决,一定给分?
- 求救,点击按钮,不通过ActiveXObject,执行cmd命令,
- jsp 后台报错日志;
好了送分啊.我现在要点分提问