Openfire contact group 's + treeview

i strat to dev openfire little time,

met a question.

it is only a layer between group to user,db’s table is also too,maybe group1:menber1;

i want to set multi-layer with treeview about contact group.

plan to

1 server,make a jsp page,set this treeview group to db server,or get this treeview group contact from db table,

2 then sent to client spark to display by xmpp protocol.

or ldap ,little associate with step1 &2,

how to do,step1 & 2.

konw none about it, maybe it is a bad path to do it,

if possible,teach me,

thank u!