課程
/后端開發
/Java
/JAVA遇見HTML——JSP篇
老師,為什么我的點擊登錄頁面不發生跳轉?。繘]有任何反應,也沒有報錯。
2015-03-18
源自:JAVA遇見HTML——JSP篇 3-6
正在回答
?<from action="dologin.jsp" name="loginForm" method="get">
是form,不是from
代碼俠 提問者
我用的是myEclipse for Spring 2014
login.jsp的代碼:
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
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>
? ? <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>
? ? <h1>用戶登錄</h1>
? ? <hr>
? ? <from action="dologin.jsp" name="loginForm" method="get">
? ? <table>
? ? <tr>
? ? <td>用戶名:</td>
? ? <td><input type="text" name="dologin.jsp"/></td>
? ? </tr>
? ? <td>密碼:</td>
? ? <td><input type="password" name="passward"/></td>
? ? <td colsopan="2"><input type="submit" value="登錄"/></td>
? ? </table>
? ? </from>
? </body>
</html>
這是web.xml的內容:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
? <display-name>JspLogin</display-name>
? <welcome-file-list>
? ? <welcome-file>index.html</welcome-file>
? ? <welcome-file>index.htm</welcome-file>
? ? <welcome-file>index.jsp</welcome-file>
? ? <welcome-file>default.html</welcome-file>
? ? <welcome-file>default.htm</welcome-file>
? ? <welcome-file>default.jsp</welcome-file>
? </welcome-file-list>
</web-app>
貼一下你的代碼吧
舉報
Java Web入門級教程JSP,帶你輕松的學習JSP基礎知識
1 回答為什么只跳轉到登錄失敗頁面
2 回答頁面跳轉不了
3 回答頁面轉跳不了
2 回答頁面跳轉問題
1 回答頁面跳轉問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-03-19
?<from action="dologin.jsp" name="loginForm" method="get">
是form,不是from
2015-03-19
我用的是myEclipse for Spring 2014
login.jsp的代碼:
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
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>
? ? <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>
? ? <h1>用戶登錄</h1>
? ? <hr>
? ? <from action="dologin.jsp" name="loginForm" method="get">
? ? <table>
? ? <tr>
? ? <td>用戶名:</td>
? ? <td><input type="text" name="dologin.jsp"/></td>
? ? </tr>
? ? <tr>
? ? <td>密碼:</td>
? ? <td><input type="password" name="passward"/></td>
? ? </tr>
? ? <tr>
? ? <td colsopan="2"><input type="submit" value="登錄"/></td>
? ? </tr>
? ? </table>
? ? </from>
? </body>
</html>
這是web.xml的內容:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
? <display-name>JspLogin</display-name>
? <welcome-file-list>
? ? <welcome-file>index.html</welcome-file>
? ? <welcome-file>index.htm</welcome-file>
? ? <welcome-file>index.jsp</welcome-file>
? ? <welcome-file>default.html</welcome-file>
? ? <welcome-file>default.htm</welcome-file>
? ? <welcome-file>default.jsp</welcome-file>
? </welcome-file-list>
</web-app>
2015-03-19
貼一下你的代碼吧