Jsp2.jsp?Code=1&Name=Jack
不需要两个&window.open("Jsp2.jsp?Code="+Code1+"&Name="+Name1,"");
多了个+号<input type="text" name="Name" size="60" value="<%=request.getParameter("Name")%>">
jsp2没有显示request.getParameter
不需要两个&window.open("Jsp2.jsp?Code="+Code1+"&Name="+Name1,"");
多了个+号<input type="text" name="Name" size="60" value="<%=request.getParameter("Name")%>">
jsp2没有显示request.getParameter
调用的时候使用引号让他成为字符串
<html>
<head>
<title>
Jsp1
</title>
<style type="text/css">
.FontUnderLine { text-decoration: underline}
</style>
<script language=javascript>
function Edit(code, name){
var Code1 = code;
var Name1 = name;
window.open("Jsp2.jsp?Code="+Code1+"&Name="+Name1,"");
}
</script>
</head>
<body>
<table border="1">
</table>
<form name="form1" method="post" action="Jsp2.jsp" >
<table border="1" width="80%" >
<table border="1" width="80%" >
<tr bgcolor ="yellow">
<td width="16%">
<div align="center">Code</div>
</td> <td width="80%">
<div align="left">Name</div>
</td> </tr>
<tr border="1" width="100%" cellpadding="0" cellspacing="0" >
<td align="center" width="20%">1</td>
<td align="left" width="80%" class="FontUnderLine"><a href="Jsp2.jsp?Code=1&Name=Jack">Jack</a> </td>
</tr>
<tr>
<td align="center" width="20%">2</td>
<td align="left" width="80%" class="FontUnderLine" onclick="Edit('2','Rose')">Rose</td>
</tr>
</table>
</table>
</form>
</body>
</html>JSP2:
<html>
<head>
<title></title>
<SCRIPT language=javascript >
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" action="Jsp2.jsp" method="post">
<table border="1" width="80%" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr class="DrakRedTr">
<td colspan="10" class="WhiteBold">Description</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="8">
<tr>
<td width="5%" height="2">
<input type="submit" name="Save" value="save" onclick=" sub(this.form,save)">
</td>
<td width="62%" height="2">
<input type="button" name="button" value="Abort" onclick="abort(this.form)">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap width="18%">
<div align="right">Code:</div>
</td>
<td width="82%">
<input type="text" name="Code" size="10" value="<%=request.getParameter("Code")%> ">
</td>
</tr>
<tr>
<td width="18%">
<div align="right">Name:</div>
</td>
<td width="82%">
<input type="text" name="Name" size="60" value="<%=request.getParameter("Name")%>"> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<title>
Jsp1
</title>
<style type="text/css">
.FontUnderLine { text-decoration: underline}
</style>
<script language=javascript>
function Edit(code, name){
var Code1 = code;
var Name1 = name;
var str = "Jsp2.jsp?Code="+Code1+"&Name="+Name1
alert(str)
window.open(str,"");
}
</script>
</head>
<body>
<table border="1">
</table>
<form name="form1" method="post" action="Jsp2.jsp" >
<table border="1" width="80%" >
<table border="1" width="80%" >
<tr bgcolor ="yellow">
<td width="16%">
<div align="center">Code</div>
</td> <td width="80%">
<div align="left">Name</div>
</td> </tr>
<tr border="1" width="100%" cellpadding="0" cellspacing="0" >
<td align="center" width="20%">1</td>
<td align="left" width="80%" class="FontUnderLine"><a href="Jsp2.jsp?Code=1&Name=Jack">Jack</a> </td>
</tr>
<tr>
<td align="center" width="20%">2</td>
<td align="left" width="80%" class="FontUnderLine" onclick="Edit('2','Rose')">Rose</td>
</tr>
</table>
</table>
</form>
</body>
</html>
你运行的可以进入JSP2的页面吗?
-->
location.replace(str)
需要走http://协议访问