首先以XML文件存储数据,格式如下(作为数据库)
exam.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<exam>
<student examid="222" idcard="111">
<name>张三</name>
<location>沈阳</location>
<grade>89</grade>
</student>
<student examid="444" idcard="333">
<name>李四</name>
<location>大连</location>
<grade>97</grade>
</student>
<student examid="371425" idcard="10110">
<name>大宝</name>
<location>山东</location>
<grade>100.0</grade>
</student>
</exam>
通过DOM解析实现对学生的CRUD
首先是分层:
一般的开发顺序(自己理解,如有错误请指出,谢谢):
1: 设计数据库 (数据库的设计相当重要,一定是经过多次讨论,修正的)
2:数据库完毕,我们的entity层,也就是实体bean也就出来了。
3:写dao的CRUD操作
4:利用测试工具测试dao层代码
5:写与用户交互层(我们的交互层是依赖于底层的)
6:测试整体代码
代码:
https://github.com/EstarG/JavaWeb/tree/master/TestSM