首页 > Web开发 > 详细

3.24jsp

时间:2021-03-28 17:35:28      阅读:12      评论:0      收藏:0      [点我收藏+]
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
    table{
        width: 200px;
        height:200px;
        text-align: center;
    }
</style>
</head>
  <script type="text/javascript">
    function reloadCode()
    {
      var time=new Date().getTime();
      document.getElementById("imagecode").src="<%= request.getContextPath()%>/servlet/ImageServlet?d="+time;
    }
  </script>
<body>
登录<br/>
    <form action="dologin.jsp" name="myform"  "<%= request.getContextPath()%>/servlet/UserServlet" method="post" >
用户名:<input type="text" name="uname"><br/>
密码:<input typut="password" name="upwd"><br/>
 验证码:<input  type="text" name="checkCode"/>
    <a href="javascript:reloadCode();">
      <img alt="验证码" id="imagecode" src="<%= request.getContextPath()%>/servlet/ImageServlet"/>
      看不清楚</a><br>
   <input type="submit" value="登录">
   <form/>
</body>

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<% 

    String name = request.getParameter("uname");

    String pwd  = request.getParameter("upwd");
    
    if(name.equals("zs") && pwd.equals("123"))

        request.getRequestDispatcher("ok.jsp").forward(request, response);

    else

        request.getRequestDispatcher("no.jsp").forward(request, response);


%>
<%@ page landuage="java"  import ="java.util.*" pageEncoding="utf-8"%>
<% 
    request.setCharacterEncoding("utf-8");
    String name = request.getParameter("uname");
    String pwd = request.getParameter("upwd");
    

%>
你注册的姓名是<%=name%><br/>
你注册的密码是<%=pwd%><br/>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
    table{
        width: 200px;
        height:200px;
        text-align: center;
    }
</style>
</head>

<body>
<h1  style="color: green">登录成功</h1>
</body>
</html>

 

技术分享图片

 技术分享图片

 

3.24jsp

原文:https://www.cnblogs.com/zjzj123/p/14589031.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!