首页 > 其他分享 >修改功能用户信息回显

修改功能用户信息回显

时间:2022-08-19 16:44:37浏览次数:55  
标签:回显 resp req 用户 修改 user

修改功能用户信息回显

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta charset="utf-8">
<title>修改用户</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面 任何其他内容都*必须*跟随其后-->
<title>首页</title>

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- jQuery(Bootstrap的所有javaScrpt插件都依赖) -->
<script src="js/bootstrap.min.js"></script>
<!-- 加载Bootstrap 的所有 javaScript插件 你也可以根据需要只加载单个插件 -->
<script src="./js/bootstrap.js"></script>
<script src="text/javascript"></script>
</head>
<body>
<form action="" method="post">
<div class="form-group">
<label for="name">姓名:</label>
<input type="text" class="form-control" id="name" name="name" value="${user.name}" readonly="readonly" placeholder="请输入姓名" />
</div>

<div class="form-group">
<label>性别:</label>
<c:if test="${user.gender == '男'}">
<input type="radio" name="gender" value="男" checked/>男
<input type="radio" name="gender" value="女" />女
</c:if>
<c:if test="${user.gender == '女'}">
<input type="radio" name="gender" value="男" />男
<input type="radio" name="gender" value="女" checked/>女
</c:if>
</div>

<div class="form-group">
<label for="age">年龄:</label>
<input type="text" class="form-control" id="age" name="age" value="${user.age}" placeholder="请输入年龄" />
</div>

<div class="form-group">
<label for="address">籍贯:</label>
<select name="address" class="form-control" id="address">
<c:if test="${user.address == '陕西'}">
<option value="陕西" selected>陕西</option>
<option value="北京">北京</option>
<option value="上海">上海</option>
</c:if>
<c:if test="${user.address == '北京'}">
<option value="陕西">陕西</option>
<option value="北京" selected>北京</option>
<option value="上海">上海</option>
</c:if>
<c:if test="${user.address == '上海'}">
<option value="陕西" >陕西</option>
<option value="北京">北京</option>
<option value="上海" selected>上海</option>
</c:if>
</select>
</div>

<div class="form-group">
<label for="qq">QQ:</label>
<input type="text" class="form-control" id="qq" name="qq" value="${user.qq}" placeholder="请输入QQ号码"/>
</div>

<div class="form-group">
<label for="email">Email:</label>
<input type="text" class="form-control" id="email" name="email" value="${user.email}" placeholder="请输入邮箱地址"/>
</div>

<div class="form-group" style="text-align: center">
<input class="btn btn-primary" type="submit" value="提交" />
<input class="btn btn-default" type="reset" value="重置" />
<input class="btn btn-default" type="button" value="返回"/>
</div>
</form>
</div>
</body>
</html

jsp页面

<td><a class="btn btn-default btn-sm" href="${pageContext.request.contextPath}/FindUserServlet?id=${user.id}">修改</a>&nbsp;

Servlet跳转

public class AddUserServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置编码
req.setCharacterEncoding("utf-8");
//获取参数
Map<String, String[]> map = req.getParameterMap();
//封装对象
User user = new User();
try {
BeanUtils.populate(user, map);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
//调用Service保存
UserService service = new UserServiceImpl();
service.addUser(user);

//跳转道userListServlet
resp.sendRedirect(req.getContextPath() + "/UserListServlet");
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}

标签:回显,resp,req,用户,修改,user
From: https://www.cnblogs.com/ssr1/p/16602522.html

相关文章

  • mysql数据库修改登录密码策略
    showvariableslike'validate_password%';  查看登录密码策略默认策略  1、查看mysql初始的密码策略,    输入语句“SHOWVARIABLESLIKE'validate_p......
  • Windows中的用户和用户组
    SID每个用户账户拥有唯一的安全标识符,用来记录用户的权限SID的组成:SID=WindowsID+用户IDWindowsID:在安装Windows的过程每台计算机都会产生不同的WindowsID用户......
  • 如何快速开发一个健康助手,实时守护用户健康
    随着人们生活水平的提高,大家对健康越来越重视和关注,用户在使用一些健康App时不仅想知道身高体重等基础情况,还想了解一些关于心率、血氧等日常数据,方便随时关注自身健康状况......
  • 查看用户在某天刷题后第二天还会再来刷题的平均概率
    查看用户在某天刷题后第二天还会再来刷题的平均概率1、数据准备CREATETABLE`question_practice_detail`(`id`intNOTNULL,`device_id`intNOTNULL,`question......
  • 华为服务器修改ibmc账号密码、配置raid5、安装系统
     修改ibmc账号密码转载自:https://www.cnblogs.com/mtactor/p/2288V5.html 昵称:mtactor方法一:采用网线直连管理口1、使用网线直接连接服务器的Mgmt口,另外一端连接......
  • MongoDB 单服务器创建用户并授权
    MongoDB单服务器创建用户并授权前言之前使用MongoDB时对于用户的认证和授权一直模模糊糊,各种教程看的半半拉拉,最后勉强能用。现在有时间了来总结一下。基础1.常见......
  • Linux —用户和组
    Linux用户和组1、用户和组的概念用户的作用:Authentication:认证Authorization:授权Accouting:审计用户存在的最终目的:为了实现资源的分派组的作用:将具有相同特......
  • 如何修改 SAP ABAP OData 模型,使其支持 $expand 操作试读版
    正如本教程的开篇介绍文章SAPOData开发教程-从入门到提高(包含SEGW,RAP和CDP)所提到的,SAPOData服务开发,从实现技术上来说,可以分为三大类。因此本教程也分为三大......
  • Python3项目初始化7--ORM及其项目修改
    22、DjangoORM介绍配置数据库引擎,setting操作。##CREATEDATABASEcmdb_userDEFAULTCHARACTERSETutf8mb4COLLATEutf8mb4_unicode_ci;DATABASES={'default':......
  • Linux怎样创建FTP服务器-修改用户默认目录-完美解决
    在创建FTP服务器之有先命令:ps-ef|grepvsftpd查一下系统有没有安装vsftpd这个服务器,如果出现如下图所示的界面说明没有安装。Linux怎样创建FTP服务器然后再执行:yumi......