读书人

初学: 一个关于页面重导的有关问题

发布时间: 2011-12-03 22:57:58 作者: rapoo

初学: 一个关于页面重导的问题
<%@page contentType= "text/html "%>
<%@page pageEncoding= "gb2312 "%>
<%
String Name=request.getParameter( "txtname ");
String Pass=request.getParameter( "txtpassword ");
if((Name.equals( " ") ¦ ¦(Pass.equals( " ")) {
response.sendRedirect( "sendredirect.html ");
}
%>

<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 网页重导 </title>
</head>
<body>
提交名字 <%=Name%> <br>
提交密码 <%=Pass%> <br>
</body>
</html>
==================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">

<html lang= 'zh '>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=GB2312 ">
<title> 重导页面 </title>
</head>
<body>
<h1> 测试重导.. </h1>
<hr>
<form action= "sendredirect.jsp " method= "post " name= "form1 ">
输入姓名 <input type= "text " name= "txtname "> <br>
输入密码 <input type= "password " name= "txtpassword "> <br>
<button name= "submitButton " type= "submit "> 提交 </button>


</form>
</body>
</html>
=================================================
出错信息
type Status report

message ndredirect/

description The requested resource ( ndredirect/) is not available.
==================================================
是路径错了?//我html和jsp放在一起的啊,怎么不能得到?

[解决办法]
if(Name.equals( " ")||Pass.equals( " ")) {
response.sendRedirect( "sendredirect.html ");
}
这句这样写 其他没什么错误 放在一起路径是 没问题
requested resource is not available. 请问你有没有启动并绑定Web容器如tomcat

读书人网 >J2SE开发

热点推荐