| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 559 人关注过本帖
标题:[求助]为什么不会跳转!!
取消只看楼主 加入收藏
しΟν∈→鱈
Rank: 1
等 级:新手上路
威 望:2
帖 子:369
专家分:0
注 册:2006-10-25
收藏
 问题点数:0 回复次数:2 
[求助]为什么不会跳转!!

写了个简单的登陆界面,代码如下。但点了提交没反应!:

index.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<base href="<%=basePath%>">

<title>My JSP 'login.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>
<form action="login.jsp" method = "POST"> </form>
<table align = "center">
<tr>
<td>用户名:
<td><input type = "text" name = "name">
<tr>
<td>密码:
<td><input type = "password" name = "password">
<tr>
<td><input type = "submit" name = "commit" value="登陆" align="center">
</table>
</body>
</html>



login.jsp代码:

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<base href="<%=basePath%>">

<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>
<%
if(request.getParameter("name").equals("admin"))
if(request.getParameter("password").equals("admin"))
out.println("Welcome to here!");
else
out.println("密码错误");
else
out.println("该用户不存在");
%>
</body>
</html>
搜索更多相关主题的帖子: request java String path 
2007-01-20 15:56
しΟν∈→鱈
Rank: 1
等 级:新手上路
威 望:2
帖 子:369
专家分:0
注 册:2006-10-25
收藏
得分:0 
  

开开心心的过&玩每一天!!!!
2007-01-20 16:15
しΟν∈→鱈
Rank: 1
等 级:新手上路
威 望:2
帖 子:369
专家分:0
注 册:2006-10-25
收藏
得分:0 

版主教训的是!!!


开开心心的过&玩每一天!!!!
2007-01-20 21:20
快速回复:[求助]为什么不会跳转!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032158 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved