编写一个JSP页面,实现根据一个人的18位身份证显示出生日的功能,要求把表达式声明和Scriptlet全部用到,并把结果显示在表格中

今天实战项目要求:编写一个JSP页面,实现根据一个人的18位身份证显示出生日的功能,要求把表达式声明和Scriptlet全部用到,并把结果显示在表格中,如下图所示

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style >
        #a{
            border-style: solid;
            border-width: 1px;
            border-color: black;
            border-collapse:collapse;
            width:100%;
            border-right: none;
            border-left: none;

        }
        .b{
            border-style: solid;
            border-width: 1px;
            border-color: black;
            border-collapse:collapse;
            border-right: none;
        }
        .c{

            border-style: solid;
            border-width: 1px;
            border-color: black;
            border-collapse:collapse;
            border-right: none;
            border-left: none;

        }
        .d{
            background: darkgray;
        }
    </style>
</head>
<body>
<%!
    String[] id={"010020199601026929","010020199711126928"};
    public String getId(int idd){
        String id1=id[idd].substring(6,10)+"-"+id[idd].substring(10,12)+"-"+id[idd].substring(12,14);
        return id1;
    }
%>
<table id='a'>
    <tr class='d'>
        <th class='c'>身份证</th>
        <th class='b'>生日</th>
    </tr>
    <%for(int i=0;i<id.length;i++){%>
        <tr>
            <td class='c'><%=id[i]%></td>
            <td class='b'><%=getId(i)%></td>
        </tr>
    <%}%>
</table>
</body>
</html>

  • 4
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值