RE: Im trying to add a new menu property for use with Velocity.
David Ketchin <David.Ketchin-AjuNjuTGQOklJZD/[email protected]>
| Newsgroups | gmane.comp.java.struts-menu.user |
|---|---|
| Message-ID | <7EBA35CAB674CF439C47F17AF5A70901017B4875@edn-exc-01.axiossystems.com> |
Please ignore the previous request. Type was a poor choice for a new attribute name. I have changed this to Mtype and it works fine. The velocity macro can now access the new attribute. > -----Original Message----- > From: David Ketchin > Sent: 30 April 2004 10:24 > To: struts-menu-user-TtF/[email protected] > Subject: Im trying to add a new menu property for use with Velocity. > > I use Struts-Menu 2.2 using the Velocity templates to customise and > configure some dynamic functionality and appearance attributes for > coolmenus4. > > Our aim is for our customers to be able to fully configure their menu > without having to edit JSP files. > They will be able to edit Menu-config.xml > I wan to add a new attribute to the xml called Type. > The Type attribute is a property to allow the velocity macro to perform > specific processing for the menu element. > > Ive looked over the code and thought all I needed to do was to add setters > and getters for type to MenuBase.java > Presumably Im missing something obvious somewhere. > The digester doesnt use a DTD to consume the stuts-menu file so I thought > that using reflection it would set the new property values? > Does anyone have a helpful hint ? > > relevant code is below. > > public abstract class MenuBase { > .....//other stuff > .....//other stuff > .....//other stuff > > protected String type; > .....//other stuff > > public String getType() { > return type; > } > > .....//other stuff > > public void setType(String typ) { > this.type = typ; > } > > } > > My menu-config.xml > > <Menus> > > <Menu name="Contactusermenu" title="HOMEMENU" description="test" > > > <Item name="HomeMenu" title="HOMEMENU" description="test" > forward="Main.Welcome" /> > <Item name="ContactIncidentMenu" title="INCIDENTMENU" > type="LogIncAllowed"> > <Item name="PrinterFault" > title="LOGPRINTERFAULT" forward="Incident.LogPrinterFault" /> > <Item name="SoftwareFault" > title="LOGSOFTWAREFAULT" forward="Incident.LogSoftwareFault" /> > <Item name="GeneralFault" > title="LOGGENERALFAULT" forward="Incident.LogGeneralFault" /> > <Item name="LogIncident" title="LOGINCIDENT" > forward="Incident.LogIncident" /> > </Item> > <Item name="ContactChangeMenu" title="REQUESTMENU" > type="LogRFCAllowed"> > <Item name="MoveFault" title="LOGMOVEFAULT" > forward="Incident.LogMoveFault" /> > <Item name="NewtstartFault" > title="LOGNEWSTARTFAULT" forward="Incident.LogNewstartFault" /> > <Item name="LogChange" title="LOGCHANGE" > forward="Change.LogChange" /> > </Item> > <Item name="ViewMenu" title="VIEWMENU" description="test"> > <Item name="EventMonitor" title="EVENTMONITOR" > forward="Main.EventSearch" /> > <Item name="KnowledgeBase" title="KNOWLEDGEBASE" > forward="Main.KnowledgeBase" /> > <Item name="AMSearch" title="ASSETSEARCH" > forward="Asset.AssetSearch" image="../images/select-all.png"/> > </Item> > <Item name="HelpMenu" title="HELPMENU"> > <Item name="AboutPage" title="ABOUTPAGE" > forward="Help.About" /> > <Item name="HelpPage" title="HELPPAGE" > forward="Help.Main" target="_blank"/> > </Item> > <Item name="LogoutMenu" title="LOGOUTMENU" forward="Main.Logout" > description="test"/> > </Menu> > </Menus> > > However I get the following errors in the initialisation of the > struts-menu plugin. > 16:57:42,822 ERROR [Engine] StandardContext[/assystTen]: Servlet > /assystTen threw load() exception > javax.servlet.ServletException: Failure initializing struts-menu: Error > parsing resource file: /WEB-INF/menu-config.xml nested exception is: Error > at (30, 80: LogIncAllowed > at net.sf.navigator.menu.MenuPlugIn.init(MenuPlugIn.java:67) > at > org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.jav > a:1158) > at > org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) > at javax.servlet.GenericServlet.init(GenericServlet.java:256) > at > org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java: > 935) > at > org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) > at > org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.jav > a:3421) > at > org.apache.catalina.core.StandardContext.start(StandardContext.java:3609) > at > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java > :821) > at > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) > at > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579) > at > org.jboss.web.tomcat.tc4.EmbeddedTomcatService.createWebContext(EmbeddedTo > mcatService.java:530) > at > org.jboss.web.tomcat.tc4.EmbeddedTomcatService.performDeploy(EmbeddedTomca > tService.java:309) > at > org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:428) > at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832) > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642) > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605) > at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm > pl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDisp > atcher.java:284) > at > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) > at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) > at $Proxy6.deploy(Unknown Source) > at > org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScan > ner.java:302) > at > org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanne > r.java:476) > at > org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doSca > n(AbstractDeploymentScanner.java:201) > at > org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(Abstra > ctDeploymentScanner.java:274) > at > org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192) > at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm > pl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDisp > atcher.java:284) > at > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) > at > org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.j > ava:976) > at $Proxy0.start(Unknown Source) > at > org.jboss.system.ServiceController.start(ServiceController.java:394) > at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm > pl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDisp > atcher.java:284) > at > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) > at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) > at $Proxy4.start(Unknown Source) > at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226) > at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832) > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642) > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605) > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: > 39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm > pl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDisp > atcher.java:284) > at > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) > at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) > at $Proxy5.deploy(Unknown Source) > at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384) > at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291) > at org.jboss.Main.boot(Main.java:150) > at org.jboss.Main$1.run(Main.java:395) > at java.lang.Thread.run(Thread.java:534) > > > ********************************************************************** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. ********************************************************************** ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click