资源描述:
《java和websocket开发网页聊天室》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Java和WebSocket开发网页聊天室一、项目简介WebSocket是HTML5一种新的协议,它实现了浏览器与服务器全双工通信,这里就将使用WebSocket来开发网页聊天室,前端框架会使用AmazeUI,后台使用Java,编辑器使用UMEditor。二、涉及知识点网页前端(HTML+CSS+JS)和Java三、软件环境1.Tomcat72.JDK73.EclipseJavaEE4.现代浏览器四、效果截图otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJian
2、gxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARm
3、issions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand效果1效果2otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939served
4、asrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitt
5、eeSecretary,Ministersand五、项目实战1.新建项目打开桌面上EclipseJavaEE,新建一个名为Chat的DynamicWebProject,然后导入处理JSON格式字符串所需要的包,把commons-beanutils-1.8.0.jar、commons-collections-3.2.1.jar、commons-lang-2.5.jar、commons-logging-1.1.1.jar、ezmorph-1.0.6.jar和json-lib-2.4-jdk15.jar这几个包放在WebContent/
6、WEB-INF/lib目录下,最后把项目发布到Tomcat服务器上,到此空项目就搭建完成了。2.编写前端页面在WebContent目录下新建一个名为index.jsp的页面,这里使用了AmazeUI框架,它是一个跨屏自适应的前端框架,消息输入框使用了UMEditor,它是一个富文本在线编辑器,能让我们的消息内容多姿多彩。首先从AmazeUI官网下载压缩包,然后解压把assets文件夹拷贝到WebContent目录下,这样我们就能使用AmazeUI了。再从UEditer官网下载Mini版的JSP版本压缩包,解压后把整个目录拷贝到We
7、bContent目录下,接下来就可以编写前端代码了,代码如下(你可以按照自己的喜好编写):<%@pagelanguage="java"contentType="text/html;charset=UTF-8"pageEncoding="UTF-8"%>8、device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
ShiYanLouChat