【Jsp精品源码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。
网学会员整理了Jsp精品源码-【精品】模块开发卷宗 - 其它资料的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
第七届齐鲁软件设计大赛 网上淘宝——网络资源检索 模块开发卷宗 参赛单位:山东师范大学 信息科学与工程学院 作品名称:网上淘宝 团队名称:梦想团队1 标题 ...................................................................................................................................................... 32 模块开发情况表.................................................................................................................................. 33 功能说明 .............................................................................................................................................. 34 设计说明 .............................................................................................................................................. 35 源代码清单 .......................................................................................................................................... 46 测试说明 ............................................................................................................................................ 897 复审的结论 ........................................................................................................................................ 921 标题 系统名称: 梦想网络资源检索系统 梦想网络资源检索系统前台页面主要是
JSP页面的制作,后台代码主要包含十九大模块程序设计: 1)选举、注册、注销模块 2)rmi模块 3)组播模块 4)索引建立模块 5)XML文档解析模块 6)XML优化模块 7)全文检索模块 8)查询过滤模块 9)查询扩展模块 10)ajax模块 11)查询模块 12)高级检索模块 13)高亮显示模块 14)文档预览模块 15)流媒体视频播放模块 16)视频普通播放模块 17)资源下载模块 18)MD5加密模块 19)后台管理模块2 模块开发情况表 各个模块都已经顺利完成。
3 功能说明 。
详见《详细设计说明》4 设计说明 。
详见《详细设计说明》5 源代码清单 1)选举、注册、注销模块 注册和选举程序算法:public class SearchServer public static void mainString args throws JDOMExceptionIOException if System.getSecurityManager null System.setSecurityManagernew RMISecurityManager ListenThread startListenernew ListenThread startListener.start InetAddress IP InetAddress.getLocalHost String ipIP.getHostAddress String theBindquotrmi://quotipquot/searchsourcequot Boolean isonline GetNodeProperty retpropertynew GetNodeProperty String hostipretproperty.getNodeProperty CreateXml.createXmlquotHostIpquot quotIpquot AddXmlChildNode.addXmlChildNodequotHostIpquot quotIpChildquot hostipfalse try SearchImplement theRemote new SearchImplement LocateRegistry.createRegistry1099 Naming.rebindtheBind theRemote ifip.equalshostip CreateXml.createXmlquotIpAddressListquot quotIpquot AddXmlChildNode.addXmlChildNodequotIpAddressListquotquotIpChildquot ip true CreateXml.createXmlquotHostIpquot quotIpquot AddXmlChildNode.addXmlChildNodequotHostIpquot quotIpChildquot ipfalse else SearchInterface remote try isonlineSendPacket.sendPackethostip ifisonline thrownew Exception remote SearchInterfaceNaming.lookupquotrmi://quothostipquot/searchsourcequot CreateXml.createXmlquotIpAddressListquot quotIpquot AddXmlChildNode.addXmlChildNodequotIpAddressListquotquotIpChildquot ip true CreateXml.createXmlquotHostIpquot quotIpquot AddXmlChildNode.addXmlChildNodequotHostIpquot quotIpChildquothostip false remote.theFirstServerip catchException e System.out.printlnquot主服务器已异常退出服务网络正在处理,请稍候......quot GetAllIpList allipnew GetAllIpList Stringgetalliplistallip.getAllIpListquotAllIpAddressListquot int i fori0iltgetalliplist.lengthi try ifgetalliplisti.equalsip continue isonlineSendPacket.sendPacketgetalliplisti ifisonline thrownew Exception remote SearchInterfaceNaming.lookupquotrmi://quotgetalliplistiquot/searchsourcequot Stringthereturnhostremote.returnHostIpList String therealhostipquotquot try isonlineSendPacket.sendPacketthereturnhost0 ifisonline thrownew Exception remote SearchInterfaceNaming.lookupquotrmi://quotthereturnhost0quot/searchsourcequot CreateXml.createXmlquotIpAddressListquotquotIpquot AddXmlChildNode.addXmlChildNodequotIpAddressListquot quotIpChildquot iptrue remote.theFirstServerip CreateXml.createXmlquotHostIpquot quotIpquot AddXmlChildNode.addXmlChildNodequotHostIpquotquotIpChildquot thereturnhost0 false break catchException e1 isonlineSendPacket.sendPacketgetalliplisti ifisonline thrownew Exception remote SearchInterfaceNaming.lookupquotrmi://quotgetalliplistiquot/searchsourcequot remote.deleteIpthereturnhost0quotIpAddressListquottrue remote.writeIPipquotIpAddressListquottrue Stringthereturnalliplistremote.returnElectorsIpList HostIp getrealhostipnew HostIp therealhostipgetrealhostip.theRealHostIpthereturnalliplist CreateXml.createXmlquotIpAddressListquotquotIpquot AddXmlChildNode.addXmlChildNodequotIpAddressListquot quotIpChildquot iptrue CreateXml.createXmlquotHostIpquot quotIpquot AddXmlChildNode.addXmlChildNodequotHostIpquot quotIpChildquot therealhostipfalse forintj0jltthereturnalliplist.lengthj AddXmlChildNode.addXmlChildNodequotIpAddressListquot quotIpChildquotthereturnalliplistj true try isonlineSendPacket.sendPacketthereturnalliplistj ifisonline thrownew Exception remote SearchInterfaceNaming.lookupquotrmi://quotthereturnalliplistjquot/searchsourcequot remote.writeIPipquotIpAddressListquot true remote.deleteIpthereturnhost0 quotIpAddressListquot true remote.deleteIpthereturnhost0 quotHostIpquot false remote.writeIPtherealhostipquotHostIpquot true catchException e2 continue break catchException e1 System.out.printlnquot主服务器已异常退出服务网络,试图与 正在寻找下一可用IP地址, quotgetalliplistiquot 建立连接失败, 请稍候......quot System.out.printlnquotquot System.out.printlnquot寻找到服务网络,正在加入,请稍候!quot System.out.printlnquotquot ifigetalliplist.length CreateXml.createXmlquotIpAddressListquot quotIpquot AddXmlChildNode.addXmlChildNodequotIpAddressListquotquotIpChildquot ip true CreateXml.createXmlquotHostIpquot quotIpquot AddXmlChildNode.addXmlChildNodequotHostIpquotquotIpChildquot ip false System.out.printlnquot远程对象窗口RMI服务器正在运行......quot catch Exception e System.out.printlne.getMessage e.printStackTrace 正常退出程序算法:public class ServerNormalExit public static void mainString args throws JDOMExceptionIOException SearchInterface theRemote SAXBuilder delipnew SAXBuilder Boolean isonline try InetAddress IP InetAddress.getLocalHost String ipIP.getHostAddress BufferedReader bftcnew BufferedReadernew FileReadernewFilequotC:/Documents and Settings/TOMCAT_HOME.txtquot String pathbftc.readLine bftc.close Documentdocdelip.buildquotfile:quotpathquot/webapps/mengxiang/WEB-INF/classes/IpAddressList.xmlquot Element rootdoc.getRootElement List findiproot.getChildren GetAllIpList gethostipnew GetAllIpList String thereturnhostgethostip.getAllIpListquotHostIpquot ifip.equalsthereturnhost0 GetAllIpList thereturnelectorsiplistnew GetAllIpList Stringthereturnelectorsthereturnelectorsiplist.getAllIpListquotIpAddressListquot int iplistlengththereturnelectors.length String therealhostipquotquot forint i0iltiplistlengthi HostIp getrealhostipnew HostIp therealhostipgetrealhostip.theRealHostIpthereturnelectors try isonlineSendPacket.sendPackettherealhostip ifisonline thrownew Exception theRemote SearchInterfaceNaming.lookupquotrmi://quottherealhostipquot/searchsourcequot break catchException e1 ServerAbnormalExit.serverAbnormalExittherealhostip thereturnelectorsthereturnelectorsiplist.getAllIpListquotIpAddressListquot thereturnelectorsthereturnelectorsiplist.getAllIpListquotIpAddressListquot forint j0jltthereturnelectors.lengthj try isonlineSendPacket.sendPacketthereturnelectorsj ifisonline thrownew Exception theRemote SearchInterfaceNaming.lookupquotrmi://quotthereturnelectorsjquot/searchsourcequot theRemote.deleteIpip quotHostIpquot false theRemote.writeIPtherealhostip quotHostIpquotfalse catchException e2 continue forint i0iltfindip.sizei Element findelement Element findip.geti try isonlineSendPacket.sendPacketfindelement.getText ifisonline thrownew Exception theRemote SearchInterfaceNaming.lookupquotrmi://quotfindelement.getTextquot/searchsourcequot theRemote.deleteIpipquotIpAddressListquottrue catchException e2 continue else forint i0iltfindip.sizei Element findelement Element findip.geti try isonlineSendPacket.sendPacketfindelement.getText ifisonline thrownew Exception theRemote SearchInterfaceNaming.lookupquotrmi://quotfindelement.getTextquot/searchsourcequot theRemote.deleteIpipquotIpAddressListquottrue catchException e continue catch Exception e System.out.printlnquotSearchClient exception: quot e.getMessage e.printStackTrace SAXBuilder getrenew SAXBuilder BufferedReader bftcnew BufferedReadernew FileReadernewFilequotC:/Documents and Settings/TOMCAT_HOME.txtquot String pathbftc.readLine bftc.close Documentdocgetre.buildquotfile:quotpathquot/webapps/mengxiang/WEB-INF/classes/IpAddressList.xmlquot Element rootdoc.getRootElement List iplistroot.getChildren for int i 0 i lt iplist.size i Element next Elementiplist.geti next.detach i-- Format format Format.getCompactFormat format.setEncodingquotUTF-8quot format.setIndentquot quot XMLOutputter XMLOut new XMLOutputterformat XMLOut.outputdoc newFileOutputStreampathquot/webapps/mengxiang/WEB-INF/classes/IpAddressList.xmlquot 异常退出程序算法:public class ServerAbnormalExit public static void serverAbnormalExitString abnormalExitIp System.out.printlnquot发现异常退出服务器!此次查询会花费较长时间,请耐心等候!为给您带来的不便深表歉意......quot System.out.printlnquot服务器 quotabnormalExitIpquot 异常退出!quot Boolean isonline SearchInterface theRemote SAXBuilder delipnew SAXBuilder try BufferedReader bftcnew BufferedReadernew FileReadernewFilequotC:/Documents and Settings/TOMCAT_HOME.txtquot String pathbftc.readLine bftc.close Documentdocdelip.buildquotfile:quotpathquot/webapps/mengxiang/WEB-INF/classes/IpAddressList.xmlquot Element rootdoc.getRootElement List findiproot.getChildren forint i0iltfindip.sizei Element findelement Element findip.geti iffindelement.getText.equalsabnormalExitIp findelement.detach i-- else try isonlineSendPacket.sendPacketfindelement.getText ifisonline thrownew Exception theRemote SearchInterfaceNaming.lookupquotrmi://quotfindelement.getTextquot/searchsourcequot theRemote.deleteIpabnormalExitIpquotIpAddressListquottrue catchException e continue return catch Exception e System.out.printlnquot再次发现异常退出服务器!稍后将予以处理,请耐心等待......quot return 2)rmi模块 rmi 模块程序算法:public class SearchServer public static void mainString args throws JDOMExceptionIOException if System.getSecurityManager null System.setSecurityManagernew RMISecurityManager ListenThread startListenernew ListenThread startListener.start InetAddress IP InetAddress.getLocalHost String ipIP.getHostAddress String theBindquotrmi://quotipquot/searchsourcequot Boolean isonline GetNodeProperty retpropertynew GetNodeProperty String hostipret.