target problem using Xtreemenu or Velocitymenudisplayer in Struts-menu
Solution I: Can solve Velocitymenudisplayer problem: Modify Template/templates/xtree.html
Show JavaScript, use JavaScript file different (column: xtree,xloadtree) Just look different, of course, to use menu_table other field values can add their own columns
The red part for the added part
# # DisplayMenu is defined in WEB-INF/CLASSES/GLOBALMACROS.VM
#macro (MenuItem $menu $level)
# # Set Title
#set ($title = $displayer. GetMessage ($menu. title))
#set ($node = $menu. Name)
#if ($level = 0)
var $node = new Webfxtree (' $title ' #if ($menu. url), ' $!menu.url ' #end);
#else
var $node = new Webfxtreeitem (' $title ' #if ($menu. url), ' $!menu.url ' #end);
#if ($menu. Target) ${node}.target= ' $menu. Target '; #end
${menu.parent.name}.add ($node);
#end
#end
#displayMenu ($menu 0)
document.write ($menu. Name);
Programme II: Solutions to Xtreemenu and velocitymenudisplayer problems we clicked on a node in the tree, and the page returned was displayed in the main page. This is done by setting the target= "main" of the hyperlink. In Struts-menu, if you use Dropdownmenudisplayer, you can set the target attribute of the menu, but if you make the Velocitymenudisplayer display, setting the target property will not work. Because the real implementation shows Scripts/xtree.js, and Xtree.js ignores target for the menu setting, you can set target by modifying the Xtree.js code.
The red section adds a target attribute to the Webfxtreeabstractnode definition: Main is the name that displays the result frame.
function Webfxtreeabstractnode (stext, saction) {
This.childnodes = [];
This.id = Webfxtreehandler.getid ();
This.text = Stext | | Webfxtreeconfig.defaulttext;
this.action = Saction | | Webfxtreeconfig.defaultaction;
This._last = false;
This.target = "Main";
Webfxtreehandler.all[this.id] = this;
}
Plan Three: This project has not been tested, also does not recommend use, see source code only in Listmenudisplayer use, and Listmenudisplayer target attribute used to be useful
Modify the Struts-menu source code: Displayerstrings.properties and then compile on the line.
The red section is added, and you can set the target value to be set in which frame you want to open the menu point in the Struts-menu.
#starts the top level of the menu
Dd.menu.top=<table width/= "style/=" "Background-color/:lightgrey" Cellpadding/=1 cellspacing/=1><tr ALIGN/=LEFT><TD nowrap class/=normal><b>
Dd.menu.bottom=</td></tr></table>
Dd.image.src.expand=/public/resources/menu/images/rarrow.gif
Dd.link.start=<a href/= ' {0} ' target/= ' {1} ' title/= ' {2} ' style/= ' Text-decoration/:none;font-family/:helvetica, arial;font-size/:12px ">
Dd.link.end=</a>
dd.js.toggle.display= function Togglemenudisplay (menu, img) {0}/n var cookiename/= "menu-" + menu.id;/n if (menu.styl E.display/=/= ' None ' {0}/n menu.style.display/= ' block '; n/a img.src/= imgsrcexpanded;/n setcookie (cookiename, ' bl Ock '); /n {1} else{0}/n menu.style.display/= ' none ';/n img.src/= imgsrcexpand;/n setcookie (cookiename, ' none '); {1}/n{1}
Dd.js.start=/n<script type/= "Text/javascript" >/n
Dd.js.end=/n</script>
#area on the document that toggles the display of the associated menu
Dd.menu.expander=<label style/= "Cursor/:hand;font-family/:verdana;font-size/:12px;font-weight/:bold" onmouseover/= "this.style.color/= ' Red" "onmouseout/=" this.style.color/= ' Black ' "onclick/=" Togglemenudisplay ( document.getElementById (' {0} '), document.getElementById (' {1} ') ' > {2} </label>
Dd.menu.restricted=<label style/= "Cursor/:hand;font-family/:verdana;font-size/:12px;font-weight/:bold" onmouseover/= "this.style.color/= ' Red" "onmouseout/=" this.style.color/= ' Black ' "onclick/=" return False "> {2} < /label>
Dd.menu.restore=<script type= "Text/javascript" >/n var redisplay/= (' GetCookie} ');/n if (menu-{0 redisplay ' B Lock ')/n Togglemenudisplay (document.getElementById (' {0} '), document.getElementById (' {1} '), false);/n</script >
#starts a menu item
Dd.menu.item.top=<div id/= "{0}" style/= "Display/:none" >/n<table cellpadding/= "0" cellspacing/= "0" >/n
Dd.menu.item.bottom=</table></div>
dd.menu.item.row.start=<tr><td>
Dd.menu.item.row.end=</td></tr>
Dd.image=
Dd.image.src.expanded=/public/resources/menu/images/darrow.gif
Dd.image.expander=
dd.js.image.src.expand= var imgsrcexpand/= "{0}";/n
dd.js.image.src.expanded= var imgsrcexpanded/= "{0}";/n
Smd.style=<style type= "Text/css" >/n. Smd-menu-top {0}font-family:verdana,arial;font-size:12px;font-weight: bold{1}/n. smd-menu-item {0}font-family:verdana,arial;font-size:12px; {1}/n Img.smd-menu {0}border:0{1}/n A.smd-menu {0}text-decoration:none{1}/n</style>
Smd.menu.top=<table cellpadding/= "0" cellspacing/= "1" >/n
smd.menu.bottom=</table>/n
SMD.MENU.ITEM.TOP=<TR><TD class/= "Smd-menu-top" >{0}</td></tr>/n
SMD.MENU.ITEM=<TR><TD class/= "Smd-menu-item" ><a href/= "{0}" class/= "Smd-menu" target/= "{1}" title/= " {2} ' >{3}</a></td></tr>/n
Smd.menu.item.image=
smd.menu.item.image.bullet=
#TODO: add/n and/t ' to make it look prettier and mouse event handlers
Lmd.js.start=/n<script type= "Text/javascript" >/n<!--/n/twindow.onload = function () {/n
Lmd.js=/t/tinitializemenu ("{0}", "{1}");
Lmd.js.expand=/t/texpandmenus ()/n
Lmd.js.stop=/t}/n//-->/n</script>
Lmd.begin=<ul {0}class= "menulist" >/n
Lmd.end=</ul>
Lmd.menu.top=/t<li class= "MenuBar" >/n
lmd.menu.bottom=/t</li>/n
Lmd.menu.actuator.link=/t<a href= "#" id= "{0}actuator" class= "actuator" > </a><a href= "{3}" Title= ' {1} ' target = ' Main ' class= ' base ' >{1}</a>/n/t/t<ul id= ' {0}menu ' class= ' {2} ' >/n
Lmd.menu.actuator.top=/t<a href= "#" id= "{0}actuator" class= "actuator" >{1}</a>/n/t/t<ul id= "{0}Menu" Class= ' {2} ' >/n
lmd.menu.actuator.bottom=/t/t</ul>/n/t</li>/n
Lmd.menu.item=/t<li><a href= ' {0} ' title= ' {1} ' {2}>{3}</a></li>
Lmd.menu.standalone=/t<a href= ' {0} ' title= ' {1} ' class= ' standalone ' {2}>{3}</a>
#coolmenus HTML
Cm.image=
#tabbedmenu HTML
Tmd.menu.tab=<a href= ' {0} ' title= ' {1} ' {2}>{3}</a>/n/t<ul class= ' submenu ' >/n
Tmd.menu.item=/t<li><a href= ' {0} ' title= ' {1} ' {2}>{3}</a></li>
# CSS List Menu
ccslm.menu.top=/t<li{0}>/n
Ccslm.menubar.top=/t<a href= ' {0} ' {1}>{2}</a>/n