zoukankan      html  css  js  c++  java
  • 编写jsp将用户注册信息保存在application中

    1、注册页面代码

    <%@ 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=UTF-8">
    <title>注册</title>
    </head>
    <body>
    <form action="baocun.jsp" method="post">
    <table>
    <tr><td>
    帐号:<input type="text" name="name"><br>
    密码:<input type="password" name="password"><br>
    <br><input type="submit" value="确认注册">
    </td></tr>
    </table>
    </form>
    </body>
    </html>
    

     2、将信息存入application代码

    <%@ 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=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    application.setAttribute("name",request.getParameter("name"));
    application.setAttribute("password",request.getParameter("password"));
    
    %>
    application接收到提交内容!
    </body>
    </html>
    

     3、运行结果

  • 相关阅读:
    ConnectionUtils
    设置组件内容模板和头部模板
    设置idea 代码模板
    Win10 安装流程 Maven
    IDEA: Error:java: 无效的源发行版: 9
    eclipse js的自动提示
    SQLserver SQL语句自动格式化工具的调出
    java计算两个n阶矩阵相乘
    JSP页面输出数据库表格
    threadpool 的配置实用
  • 原文地址:https://www.cnblogs.com/jakeasd/p/5631858.html
Copyright © 2011-2022 走看看