課程
/后端開發(fā)
/Java
/JAVA遇見HTML——JSP篇
老師,為什么我的點(diǎn)擊登錄頁面不發(fā)生跳轉(zhuǎn)啊?沒有任何反應(yīng),也沒有報(bào)錯(cuò)。
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的內(nèi)容:
<?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>
貼一下你的代碼吧
舉報(bào)
Java Web入門級(jí)教程JSP,帶你輕松的學(xué)習(xí)JSP基礎(chǔ)知識(shí)
1 回答為什么只跳轉(zhuǎn)到登錄失敗頁面
2 回答頁面跳轉(zhuǎn)不了
3 回答頁面轉(zhuǎn)跳不了
2 回答頁面跳轉(zhuǎn)問題
1 回答頁面跳轉(zhuǎn)問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
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的內(nèi)容:
<?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
貼一下你的代碼吧