Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
LeftMenu




JSPWiki v2.2.33

[RSS]


Hide Menu

StrutsMenu


Difference between version 34 and version 33:

At line 1 changed 170 lines.
[googleÅÅÃû|http://www.yourgoogle.com]
[google×ó²àÅÅÃû|http://www.yourgoogle.com/google-list/google-list.htm ]
[ÍøÕ¾½¨Éè|http://www.yourgoogle.com/webdesign/webdesign-1.htm]
[googleÍƹã|http://googlesz.freewebpage.org]
[googleÅÅÃû|http://googlegd.freewebpage.org]
[ inflatables|http://www.inflatables-china.com]
[Îå½ð¹¤¾ß|http://www.swellongtools.com]
[ÄÉÃ×|http://nami8.freewebpage.org]
[ÍøÂçÓªÏú|http://www.tlup.com]
[ÏîÄ¿ºÏ×÷|http://www.tlup.com]
[ÍøÂçÉãÏñ»ú|http://www.sfcomm.com]
[ÍøÂçÉãÏñ»ú|http://swellong.freewebpage.org]
[ÏÊ»¨|http://www.flowerwish.com]
[ÍøÉÏ»¨µê|http://www.flowerwish.com]
[ɽÌØ|http://www.flowerwish.com/ups]
[ɽÌØupsµçÔ´|http://www.flowerwish.com/ups]
[APCµçÔ´|http://www.flowerwish.com/ups]
[ɽÌصçÔ´|http://www.flowerwish.com/ups]
[²£Á§|http://glasses.freewebpage.org ]
[ÍøÂ綩»¨|http://www.FLOWERWISH.com/events/fwa.asp]
[ÍøÂ绨µê|http://www.FLOWERWISH.com/events/fwb.asp]
[ÍøÂçËÍ»¨|http://www.FLOWERWISH.com/events/fwc.asp]
[Á¬Ëø»¨µê|http://www.FLOWERWISH.com/events/fwd.asp]
[»¨µê|http://www.FLOWERWISH.com/events/fwe.asp]
[ÍøÉÏÏÊ»¨|http://www.FLOWERWISH.com/events/fwf.asp]
[ÏÊ»¨µê|http://www.FLOWERWISH.com/events/fwg.asp]
[Âò»¨|http://www.FLOWERWISH.com/events/fwh.asp]
[꿃즩Ȭ|http://www.FLOWERWISH.com/events/fwi.asp]
[ÍøÉÏ»¨µê|http://www.FLOWERWISH.com/events/fwj.asp]
[ÍøÉÏÀñÆ·|http://www.FLOWERWISH.com/events/fwk.asp]
[ÍøÉÏÂò»¨|http://www.FLOWERWISH.com/events/fwl.asp]
[ÍøÉÏËÍ»¨|http://www.FLOWERWISH.com/events/fwm.asp]
[ÍøÉÏ»¨µê|http://www.FLOWERWISH.com/events/fwn.asp]
[ÍøÉÏÏÊ»¨ËÙµÝ|http://www.FLOWERWISH.com/events/fwo.asp]
[ÏÊ»¨ËÙµÝ|http://www.FLOWERWISH.com/events/fwp.asp]
[ÏÊ»¨ÅäËÍ|http://www.FLOWERWISH.com/events/fwq.asp]
[ÏÊ»¨¿ìµÝ|http://www.FLOWERWISH.com/events/fwr.asp]
[ÏÊ»¨Íø|http://www.FLOWERWISH.com/events/fws.asp]
[ÉúÈÕÏÊ»¨|http://www.FLOWERWISH.com/events/fwt.asp]
[ÀñÒÇÏÊ»¨|http://www.FLOWERWISH.com/events/fwu.asp]
[°®ÇéÏÊ»¨|http://www.FLOWERWISH.com/events/fwv.asp]
[¶©»¨|http://www.FLOWERWISH.com/events/fww.asp]
[¹ú¼ÊËÍ»¨|http://www.FLOWERWISH.com/events/fwx.asp]
[ÏÊ»¨ÀñÆ·Íø|http://www.FLOWERWISH.com/events/fwy.asp]
[ÏÊ»¨ÀñÆ·µê|http://www.FLOWERWISH.com/events/fwz.asp]
[ÇéÈ˽ÚÏÊ»¨|http://www.flowerwish.com/events/f1.asp]
[ÇéÈ˽Úõ¹å|http://www.flowerwish.com/events/f2.asp]
[ĸÇ×½ÚÏÊ»¨|http://www.flowerwish.com/events/f3.asp]
[¸¸Ç×½ÚÏÊ»¨|http://www.flowerwish.com/events/f4.asp]
[ÆßϦÏÊ»¨|http://www.flowerwish.com/events/f5.asp]
[½Ìʦ½ÚÏÊ»¨|http://www.flowerwish.com/events/f7.asp]
[Ê¥µ®½ÚÏÊ»¨|http://www.flowerwish.com/events/f8.asp]
[±±¾©ÏÊ»¨|http://www.flowerwish.com/city/1a.asp]
[Ìì½òÏÊ»¨|http://www.flowerwish.com/city/2a.asp]
[ÉϺ£ÏÊ»¨|http://www.flowerwish.com/city/3a.asp]
[ÖØÇìÏÊ»¨|http://www.flowerwish.com/city/4a.asp]
[ʯ¼ÒׯÏÊ»¨|http://www.flowerwish.com/city/5a.asp]
[Ö£ÖÝÏÊ»¨|http://www.flowerwish.com/city/6a.asp]
[ÉòÑôÏÊ»¨|http://www.flowerwish.com/city/7a.asp]
[³¤´ºÏÊ»¨|http://www.flowerwish.com/city/8a.asp]
[¹þ¶û±õÏÊ»¨|http://www.flowerwish.com/city/9a.asp]
[³É¶¼ÏÊ»¨|http://www.flowerwish.com/city/10a.asp]
[ºôºÍºÆÌØÏÊ»¨|http://www.flowerwish.com/city/11a.asp]
[¸£ÖÝÏÊ»¨|http://www.flowerwish.com/city/12a.asp]
[Ì«Ô­ÏÊ»¨|http://www.flowerwish.com/city/13a.asp]
[º£¿ÚÏÊ»¨|http://www.flowerwish.com/city/14a.asp]
[ÎÚ³ľÆëÏÊ»¨|http://www.flowerwish.com/city/15a.asp]
[Òø´¨ÏÊ»¨|http://www.flowerwish.com/city/16a.asp]
[À¼ÖÝÏÊ»¨|http://www.flowerwish.com/city/17a.asp]
[Î÷°²ÏÊ»¨|http://www.flowerwish.com/city/18a.asp]
[À¥Ã÷ÏÊ»¨|http://www.flowerwish.com/city/19a.asp]
[¹óÑôÏÊ»¨|http://www.flowerwish.com/city/20a.asp]
[ÄϲýÏÊ»¨|http://www.flowerwish.com/city/21a.asp]
[ÄÏÄþÏÊ»¨|http://www.flowerwish.com/city/22a.asp]
[¹ãÖÝÏÊ»¨|http://www.flowerwish.com/city/23a.asp]
[³¤É³ÏÊ»¨|http://www.flowerwish.com/city/24a.asp]
[Î人ÏÊ»¨|http://www.flowerwish.com/city/25a.asp]
[º¼ÖÝÏÊ»¨|http://www.flowerwish.com/city/26a.asp]
[¼ÃÄÏÏÊ»¨|http://www.flowerwish.com/city/27a.asp]
[¹ÜÀí×ÊÁÏ|http://www.blueattain.com]
[ KVM|http://www.szsuun.com]
[KVM|http://www.szsuun.com/htm/kvm/kvm1.htm]
[triisopropanolamine|http://www.hongbaoli.com/eng/prod_tipa.htm]
[µÆÊÎ|http://www.flowerwish.com/dengshi]
[ÖÐɽµÆÊÎ|http://www.flowerwish.com/dengshi]
[µÆ¾ß|http://www.flowerwish.com/dengshi ]
[»·±£¼¼Êõ|http://www.flowerwish.com/huanbao]
[Ë®´¦Àí|http://www.flowerwish.com/huanbao]
[¼ÒÕþ|http://www.flowerwish.com/jiazheng]
[±£Ä·|http://www.flowerwish.com/jiazheng]
[Öӵ㹤|http://www.flowerwish.com/jiazheng]
[¿ì²Í|http://www.flowerwish.com/kuaican]
[ÉîÛÚ¿ì²Í|http://www.flowerwish.com/kuaican]
[ÉîÛÚ¶©²Í|http://www.flowerwish.com/kuaican]
[×â³µ|http://www.flowerwish.com/zuche]
[ÉîÛÚ×â³µ|http://www.flowerwish.com/zuche]
[Æû³µ×âÁÞ|http://www.flowerwish.com/zuche]
[ÎïÒµ¹ÜÀí|http://www.tlup.com/wuye]
[Çå½à|http://www.tlup.com/wuye]
[±£°²|http://www.tlup.com/wuye]
[¿ìµÝ|http://www.tlup.com/ups]
[ KVM|http://kvmkvm.freewebpage.org]
[ÆóÒµ¹ÜÀí|http://filesdown.freewebpage.org]
[¹ÜÀíÅàѵ|http://filesdown.freewebpage.org]
[µçÄÔÅä¼þ|http://hardware.freewebpage.org]
[µçÄÔÓ²¼þ|http://hardware.freewebpage.org]
[Ä£¾ß|http://moju.freewebpage.org]
[Ä£¾ß¼Ó¹¤|http://moju.freewebpage.org]
[×¢ËÜÄ£¾ß|http://moju.freewebpage.org]
[ÁÔÍ·|http://humenhunter.freewebpage.org]
[ pyrethrum|http://pyrethum.freewebpage.org ]
[ÉãÏñ»ú|http://xiangji.freewebpage.org]
[ÊýÂëÉãÏñ»ú|http://xiangji.freewebpage.org]
[ÎÛË®´¦Àí|http://wushui.freewebpage.org]
[À¬»ø´¦Àí|http://szwuye.freewebpage.org]
[Èó»¬ÓÍ|http://runhuayou.freewebpage.org]
[Îå½ð¹¤¾ß|http://chaiyou.freewebpage.org]
[¿ª¹ØµçÔ´|http://kaiguan.freewebpage.org]
[Äæ±äµçÔ´|http://kaiguan.freewebpage.org]
[Ñõ»¯Ã¾|http://yanghuamei.freewebpage.org]
[magnesia|http://magnesia.freewebpage.org]
[magnesium oxide|http://magnesium.freewebpage.org]
[electric magnesium oxide|http://magnesium.freewebpage.org]
[mica tape|http://www.ktyu.com]
[fiber glass yarn|http://www.ktyu.com]
[ EDM|http://www.edmcocn.com]
[ÆóÒµÃû¼|http://www.yourgoogle.com/company-card-index/companyindex.htm]
[ÃŽû|http://www.flowerwish.com/menjin]
[ÃŽûϵͳ|http://www.flowerwish.com/menjin]
[¿¼ÇÚ|http://www.flowerwish.com/kaoqin]
[¿¼ÇÚ»ú|http://www.flowerwish.com/kaoqin]
[¿¼ÇÚϵͳ|http://www.flowerwish.com/kaoqin]
[ÊÕ·Ñ»ú|http://www.flowerwish.com/shoufei]
[Ïû·Ñ»ú|http://www.flowerwish.com/shoufei]
[Í£³µ³¡ÏµÍ³|http://www.flowerwish.com/tingchechang]
[ÖÇÄÜÍ£³µ³¡|http://www.flowerwish.com/tingchechang]
[Í£³µ³¡|http://www.flowerwish.com/shoufei]
[ºìõ¹å|http://www.flowerwish.com/others/xianhua/rose1.asp]
[»Æõ¹å|http://www.flowerwish.com/others/xianhua/rose1.asp]
[·Ûõ¹å|http://www.flowerwish.com/others/xianhua/rose1.asp]
[°×õ¹å|http://www.flowerwish.com/others/xianhua/rose1.asp]
[õ¹å|http://www.flowerwish.com/others/xianhua/rose2.asp]
[°ÙºÏ|http://www.flowerwish.com/others/xianhua/baihe1.asp]
[Óô½ðÏã|http://www.flowerwish.com/others/xianhua/yujinxiang1.asp]
[°ÙºÏ|http://www.flowerwish.com/others/zhishi/baihecs.asp]
[²¢µÙÁ«|http://www.flowerwish.com/others/zhishi/bingdiliancs.asp]
[Ë®ÏÉ|http://www.flowerwish.com/others/zhishi/shuixiancs.asp]
[ĵµ¤|http://www.flowerwish.com/others/zhishi/mudancs.asp]
[ÜÔÀò»¨|http://www.flowerwish.com/others/zhishi/molihuacs.asp]
[²å»¨|http://www.flowerwish.com/others/zhishi/chahua.asp]
[»¨»Ü±£ÏÊ|http://www.flowerwish.com/others/zhishi/xianhuabaoxian.asp]
[ÏÊ»¨±£ÏÊ|http://www.flowerwish.com/others/zhishi/xianhuabaoxian.asp]
[ɽ²è»¨|http://www.flowerwish.com/others/zhishi/shanchahuacs.asp]
[Ç黨|http://www.flowerwish.com/others/jieri/qinghua.asp]
[¸¸Ç×½ÚËÍ»¨|http://www.flowerwish.com/others/jieri/fuqinjie.asp]
[ĸÇ×½ÚËÍ»¨|http://www.flowerwish.com/others/jieri/muqinjie.asp]
[½Ìʦ½ÚËÍ»¨|http://www.flowerwish.com/others/jieri/jiaoshijie.asp]
[ÇéÈ˽ÚÀ´Àú|http://www.flowerwish.com/others/jieri/qingrenjie.asp]
[ÇéÈ˽ÚÏÊ»¨|http://www.flowerwish.com/others/jieri/qingrenjie.asp]
[Ê¥µ®½ÚËÍ»¨|http://www.flowerwish.com/others/jieri/shengdanjie.asp]
[ÖйúÇéÈ˽Ú|http://www.flowerwish.com/others/jieri/qingrenjiecn.asp]
[ÆßϦËÍ»¨|http://www.flowerwish.com/others/jieri/qingrenjiecn.asp]
[ÈçºÎËÍ»¨|http://www.flowerwish.com/others/shijian/songhualiyi.asp]
[ËÍ»¨µÄѧÎÊ|http://www.flowerwish.com/others/shijian/songhualiyi.asp]
[ºÏ·ÊÏÊ»¨|http://www.flowerwish.com/city/28a.asp]
[ÄϾ©ÏÊ»¨|http://www.flowerwish.com/city/29a.asp]
[Î÷ÄþÏÊ»¨|http://www.flowerwish.com/city/30a.asp]
[À­ÈøÏÊ»¨|http://www.flowerwish.com/city/31a.asp]
[Ïã¸ÛÏÊ»¨|http://www.flowerwish.com/city/32.asp]
[̨ÍåÏÊ»¨|http://www.flowerwish.com/city/33.asp]
I did some refactorings on [Struts Menu|http://sourceforge.net/projects/struts-menu] in the last few days and thought I'd document them here as it's a bit more convenient than via e-mail. Also, I have a couple issues that might be better exposed here vs. a mailing list.
!!Refactorings
* Migrated to [Maven|http://maven.apache.org] for building and deploying.
* Renamed package from ''com.fgm.menu'' to ''net.sf.navigator''.
* Checked in as a new module [on SourceForge|http://sourceforge.net/cvs/?group_id=48726] called "navigator". I liked the name and thought it would be a bit cleaner than "struts-menu" going forward. I'd like to use the same project at SF, just have a new name for the package/releases/files.
* Added the ability to specify dynamic parameters in menu-config.xml. Example:
{{{ page="/velocity.jsp?test=${test} }}}
In this example, the variable 'test' is searched for using pageContext.findAttribute("test"). You could easily set this parameter using JSTL and <c:set var="test" value="value" />. I also added support for request parameters if not found in the pageContext.
* Added a VelocityMenuDisplayer which puts a bunch of stuff in a VelocityContext for creating of menus with Velocity. This might make for an easy way to use this navigation system and build it from a database. Just put your Tree (or whatever you want to use) into the request, and grab it in the template. Here are all the current variables exposed:
[{Java2HtmlPlugin
context.put("formatter", new VelocityFormatter(context));
context.put("now", Calendar.getInstance().getTime());
context.put("ctxPath", request.getContextPath());
// see if a name and property were passed in
if (!StringUtils.isEmpty(name)) {
Object val1 =
RequestUtils.lookup(pageContext, name, null, null);
if (val1 != null) {
context.put(name, val1);
}
}
// request-scope attributes
Enumeration enum = request.getAttributeNames();
while (enum.hasMoreElements()) {
String name = (String) enum.nextElement();
Object value = request.getAttribute(name);
context.put(name, value);
}
context.put("request", request);
context.put("session", request.getSession());
context.put("menu", menu);
context.put("displayer", this);
}]
Here is a sample velocity template for rendering a simple menu. It shouldn't be too hard to re-create the existing using Velocity templates.
{{{
## Evaluates other macros.
#macro(eval $_macro)$_macro#end
#macro( displayMenu $menu $level )
#if ($menu.components.size() > 0)
## display top menu
#menuItem($menu $level)
#foreach ($menu in $menu.components)
#local ($menu $level)
#set ($level = $level+1)
#if ($menu.components.size() > 0)
#eval("#displayMenu($menu $level)")
#else
#menuItem($menu $level)
#end
#end
#end
#else
#menuItem($menu $level)
#end
#end
#macro( menuItem $menu $level )
#foreach ($i in [0..$level])
  
#end
#if ($menu.url)
<a href="$menu.url" title="$menu.title">
$menu.title</a>
#else
$menu.title
#end
<br />
#end
#displayMenu($menu 0)
}}}
This is configured in your JSP using:
{{{
<menu:useMenuDisplayer name="Velocity" config="/table.html"
bundle="org.apache.struts.action.MESSAGE">
<menu:displayMenu name="indexMenu"/>
</menu:useMenuDisplayer>
}}}
Where __config__ points to a file relative to your webapp. You can also use config="table.html" where table.html is under WEB-INF/classes.
!!Issues
* I don't know if its Velocity or the tag library, but someone is caching the templates and the only way to get them to refresh is to restart Tomcat. I'd like to be messing with the JSP and it's template on Tomcat and just refresh them in the browser (after saving). It'd sure cut down on development time. ''Lance: This probably is Velocity, have you checked your velocity properties to make sure cache=false? And try adding this: velocimacro.library.autoreload=true''. ''Ivan: I recently found out that Tomcat 4.1.29 (and probably others) caches the content of resources loaded through getResourceAsStream() (very confusing), this may be causing your problems. As a work around my reloadable configuration class was changed to simply getResource() and then opening the stream on the URL.''
* There seems to be an issue when you have two menus (menu:useMenuDisplayer tag) on one page. The second menu seems to try and use parts of the first table's config. Wierd. ''Lance: I've seen some scope issues like this on Roller. There are some optional flags documented in the Users Guide that may help with this - though it isn't altogether clear which does what.''
__UPDATE:__ I solved all of these issues by implementing Velocity's WebappLoader rather than the one from Roller. Here's the code I used to initialize it:
[{Java2HtmlPlugin
/**
* Key used to access the ServletContext in the Velocity application attributes.
*/
public static final String SERVLET_CONTEXT_KEY = ServletContext.class.getName();
//~ Methods ================================================================
public void init(PageContext pageContext, MenuDisplayerMapping mapping) {
super.init(pageContext, mapping);
this.pageContext = pageContext;
// MR: Copied from VelocityViewServlet to initialize WebappLoader
Velocity.setApplicationAttribute(SERVLET_CONTEXT_KEY,
pageContext.getServletContext());
// default to servletlogger, which logs to the servlet engines log
Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
ServletLogger.class.getName());
// by default, load resources with webapp resource loader
Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER, "webapp");
Velocity.setProperty("webapp.resource.loader.class",
WebappLoader.class.getName());
// now all is ready - init Velocity
try {
ResourceBundle rb = ResourceBundle.getBundle("velocity");
Properties props = new Properties();
for (Enumeration keys = rb.getKeys();keys.hasMoreElements();) {
String key = (String) keys.nextElement();
props.put(key, rb.getString(key));
}
// only initialized the first time it's called, from:
// http://jakarta.apache.org/velocity/developer-guide.html
// it's ignored for subsequent calls
Velocity.init(props);
} catch (Exception e) {
log.error("Error initializing Velocity: " + e.getMessage());
e.printStackTrace();
}
}
}]
!!TODO
* Use XDoclet to generate the .tld file.
* Unit Tests!!
Comments, suggestions or questions are most welcome. If not here, doing it on one of the <a href="http://sourceforge.net/mail/?group_id=48726">mailing lists</a> is probably most appropriate.
__Update:__ [I|MattRaible] just thought of something that would be pretty cool. Allow the name in &lt;menu:displayMenu name="indexMenu"/&gt; to refer to the name of a tiles definition that defines a menu. That'd be slick!

Back to StrutsMenu, or to the Page History.