问答详情
源自:3-6 get与post提交方式的区别

登录页面不发生跳转

老师,为什么我的点击登录页面不发生跳转啊?没有任何反应,也没有报错。

提问者:代码侠 2015-03-18 16:09

个回答

  • 好帮手慕珊
    2015-03-19 13:29:07
    已采纳

     <from action="dologin.jsp" name="loginForm" method="get">

    是form,不是from

  • 代码侠
    2015-03-19 10:13:28

    我用的是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 08:30:33

    贴一下你的代码吧