jsp练习

此博客为转载内容,转载自https://www.cnblogs.com/qq993411626------/p/10831395.html ,涉及Java相关知识。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<style>
img{width:500px;
height:200px}
div{
margin:0 auto;
width:500px;
height:550px;}
</style>
<body>
<div>
<p><img alt="图片" src="img/1.jpg" ></p>
    <form action="gain.jsp" method="post">
        <p>
            账号:<input type="text" name="userName" />
        </p>
        <p>
            密码:<input type="password" name="userpass" />
        </p>
        <p>
            性别:<input name="sex" type="radio" value="男" />男 <input name="sex"
                type="radio" value="女" /></p>
        <p>
            兴趣爱好:<input name="like" type="checkbox" value="篮球" />篮球 <input
                name="like" type="checkbox" value="敲代码" />敲代码 <input name="like"
                type="checkbox" value="玩游戏" />玩游戏 <input name="like" type="checkbox"
                value="听音乐" />听音乐
        </p>
        
        

        <p>
            <input type="submit" value="注册" /> <input type="reset" value="重置" />
        </p>
    </form>
    </div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("userName");
String pass = request.getParameter("userpass");
String sex = request.getParameter("sex");
String[] love = request.getParameterValues("like");
%>
<p>用户名:<%=name %></p>
<p>密码:<%=pass %></p>
<p>性别:<%=sex %></p>
<p>兴趣爱好:<%if(love!=null){
for(String loves:love){
    out.print(loves);
}} %></p>

</body>
</html>

 

转载于:https://www.cnblogs.com/qq993411626------/p/10831395.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值