在前面的博客中,我介紹了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