在前面的博客中,我介绍了openfire插件开发,在那篇博客中我详细的说明怎样开发一个基于控制台的插件,这篇博客中我要介绍基于web的插件程序,一样,这篇博客实在openfire插件开发的基础上开发的,若是有网友不明白的,请移步至前面相关的文章,我写openfire是一系列连续性的文章,建议你们从前面开始看起,以释没头没尾之嫌,好了,进入正题:html
一、新建咱们须要的jsp文件,在插件src目录下面增长web文件夹,在web文件夹中添加一个welcome.jsp文件,这个文件须要本身编写。 能够参考其余案例插件。截图以下:java
选择新建jsp文件,截图以下:web
在welcome.jsp中随便输入写内容,个人以下:
服务器
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>helwo world welcome</title> <meta name="pageID" content="welcome" /> </head> <body> <h1>hello world</h1> <input type="text"/> <input type="submit" value="提交"> </body> </html>
修改helloWorld控制台插件的plugin.xml文件,内容以下:
jsp
<?xml version="1.0" encoding="UTF-8"?> <plugin> <class>com.helloworld.HelloWorldPlugin</class> <name>helloWorld</name> <description>First Openfire Custom Plugin.</description> <author>xieyuan</author> <version>1.0.0</version> <date>14/07/2014</date> <minServerVersion>3.9.0</minServerVersion> <adminconsole> <tab id="tab-server"> <sidebar id="sidebar-server-settings"> <item id="welcome" name="welcome" url="welcome.jsp" description="hello world" /> </sidebar> </tab> </adminconsole> </plugin>
从新编辑插件!!!!!ide
如今,咱们来看看效果,刷新页面咱们看到: ui
如今解释一下上面各个选项的含义:url
welcome.jsp中<meta name="pageID" content="welcome" />,content对应的是plugin.xml中item中的id。spa
plugin.xml中tab对应的是页面的顶部tab,好比服务器对应的是id为tab-server,用户/组对应的是tab-users,反正都有一个对应,而后sidebar对应每个tab下面的子项,好比服务器下面有两个子项分别为服务器管理器,服务器设置,对应id为sidebar-server-manager,sidebar-server-settings,最后的item节点中,id前面说了,name指页面超连接的文本。这样呢就能将插件中的页面放到本身想要的地方去。固然不必定要放到现有的tab下面,也能够新建一个tab,来存放。具体能够参考Fastpath Service这个插件的plugin.xml,照着他的例子写就好了。
.net