I want to show struts2 menu on my jsp page but it gives me errorr as follows:
javax.servlet.jsp.JspException: The menu repository could not be found.
I search on internet i found that it requires commons.lang jar, commons-logging.jar and i already have this jar in my struts2 project.
How can i show struts2 menu on my jsp page?
My jsp code as follows:
<menu:useMenuDisplayer name="TabbedMenu" config="/templates/tabs.html">
<ul id="primary-nav" >
<li class="pad"> </li>
<menu:displayMenu name="Order"/>
<menu:displayMenu name="Report"/>
<menu:displayMenu name="BatchProcessing"/>
<menu:displayMenu name="Master"/>
</ul>
</menu:useMenuDisplayer>
I have menu-config.xml as follows:
<MenuConfig>
<Displayers>
<Displayer name="TabbedMenu" type="net.sf.navigator.displayer.TabbedMenuDisplayer"/>
</Displayers>
<Menus>
<Menu name="Order" title="Order" />
<Menu name="Report" title="Report" />
<Menu name="BatchProcessing" title="Batch Processing" />
<Menu name="Master" title="Master" />
</Menus>
</MenuConfig>
add commons-logging.jar and commons-lang.jar in your project at WEB-INF/Lib
Related
I have a following xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<Abc version="3" xmlns="urn:Abc-v3">
<Ele1>
<SubElement name ="name" description="DO">
<Node version="C" siteURL="https://example.com" />
<Client>
<ClientId>1</ClientId>
<ClientSecret>Yes</ClientSecret>
</Client>
</SubElement>
<SubElement name ="SharePointOLDev1" description="DEV1">
<Node version="C" siteURL="https://example.com" />
<Local>
<LocalId>id</LocalId>
<Password>password</Password>
</Local>
</SubElement>
<SubElement name="AS" description="wow">
<DB connection="connection" />
</SubElement>
</Ele1>
<Ele2>
<Content ID="A" co="LD">
<Description>Simple Docs</Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
<FetchFilenameAttribute connection="SAP-AS" delay="3" />
</Serve>
</Content>
<Content ID="B" co="OL">
<Description>Simple Docs </Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name"">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
</Serve>
</Content>
</Ele2>
<Ele3>
<CNode attr="hai" attr1="bye" />
</Ele3>
</Abc>
I need to parse this XML file and assign values to its corresponding class objects.Which is the best option to parse such an xml file.
JAXB sounds good to me but the POJOs were already written by someone and now i will have to rewrite and deploy them.ALso teh xml file has some errors while running xjc command.
DOM approach seems to be very cumbersome n error prone.
Please suggest.
PS:Kindly excuse my beginner level knowledge.
the JDK project comes with SAX(Simple API for XML) accessible by importing org.xml.sax.*.
You may take a look at this https://www.tutorialspoint.com/java_xml/java_sax_parse_document.htm for an introduction to the subject.
I am building a component which allows the user to add a multi field. When the multifield is added to the dialog, the user is presented with two text boxes. When the user adds information to the text boxes, and clicks 'OK'. When the dialog closes, no information is stored/saved.
Can anyone point out where I've gone wrong?
See the dialog code below:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
xtype="dialog">
<items
jcr:primaryType="nt:unstructured"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<heading
jcr:primaryType="nt:unstructured"
allowBlank="true"
disabled="false"
fieldLabel="Heading (optional)"
grow="false"
hideLabel="false"
name="./headingTitle"
readOnly="false"
selectOnFocus="false"
validateOnBlur="true"
xtype="textfield"/>
<message
jcr:primaryType="nt:unstructured"
fieldLabel="Message (optional)"
name="./message"
validateOnBlur="true"
xtype="textfield"/>
<link-list
jcr:primaryType="cq:Widget"
fieldLabel="Tabs titles and binding"
border="{Boolean}false"
name="./link-list"
width="1000"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
path="/apps/group/components/nab-broker-tabs/dialog/items/items/link-list/fieldConfig/items.infinity.json"
xtype="cq.compositefield">
<items jcr:primaryType="cq:WidgetCollection">
<linkText
jcr:primaryType="cq:Widget"
fieldLabel="Titles"
name="linkText"
width="180"
xtype="textfield"/>
<linkBinding
jcr:primaryType="cq:Widget"
fieldLabel="binding ID"
name="linkBinding"
width="180"
xtype="textfield"/>
</items>
</fieldConfig>
</link-list>
</items>
</items>
</jcr:root>
Since multiple values are to be stored, you should be using a custom xtype to store multifield values.
refer: http://helpx.adobe.com/experience-manager/using/creating-custom-xtype.html
In case of complex multifield components, I would suggest you to use Multi Field Panel from ACS AEM Commons.
It will do the job for you.
I have this code in ZK, with a menu to navigate:
<zk apply="org.zkoss.bind.BindComposer"
viewModel="#id('vm') #init('menu')">
<tabbox width="100%" sclass="nav_tabs">
<tabs id="tabs">
<tab label="Admin" onSelect="updateCategory(self.label)"/>
<tab label="User" onSelect="updateCategory(self.label)"/>
</tabs>
<tabpanels>
<tabpanel>
<toolbar hflex="true">
<toolbarbutton label="CreateUser" onClick="#Command('load',label=self.label)" />
<toolbarbutton label="CreateMno" onClick="#Command('load',label=self.label)" />
</toolbar>
</tabpanel>
<tabpanel>
<toolbar hflex="true">
<toolbarbutton label="LoadData" onClick="#Command('load',label=self.label)" />
<toolbarbutton label="DownloadData" onClick="#Command('load',label=self.label)" />
</toolbar>
</tabpanel>
</tabpanels>
</tabbox>
<separator height="30px"></separator>
<zscript><![CDATA[
void updateCategory(String category) {
current_category.setValue(category);
current_subpage.setValue("Index");
}
]]></zscript>
<hlayout>
<label id="current_category" sclass="nav_text nav_category" onClick="#command('submit')">Our Product</label>
<label sclass="nav_text">-</label>
<label id="current_subpage" sclass="nav_text">Index</label>
</hlayout>
</zk>
Then i have two roles Admin, and User, and i need load the pages of each user, and i am trying that when a user click in the toolbarbutton, for example CreateUser, then call a method that load in the space of my toolbar button the page, but i do not how can i do it.
Something like:
http://www.zkoss.org/zkdemo/tabbox/navigation_tabs
but i not need a string in Our product -> Product 1 - > Our Product-Product 1, i need load a page, and i am calling the page with the same name to the label.
And a page from a java class
Somebody can help me?
Please add the following to your tabpanel:
<include id="includeID" mode="instant" src="page.zul" />
Later on, you may load another page by adding the following to a zscript:
includeID.setSrc("another_page.zul");
For some additional/custom attributes, like tab indices or tool tip texts, it would be nice to annotate the FXML with custom annotations. I have three proposals for it:
XML-Comment:
<!-- #TabIndex(index=1) -->
<Button fx:id="test_audio" text="Test" />
fx attribute:
<Button fx:id="test_audio" fx:tab_index="1" text="Test" />
Custom XML namespace attribute :
<Button fx:id="test_audio" custom:tab_index="1" text="Test" />
Is there a way to do this and get the attribute values on runtime?
I've developed a menu using struts-menu 2.4.3 with Struts 2. It's working ok but I need to take the titles of the menus from a properties file (router-messages.properties). The whole application is internationalized like this. But it just doesn't work with struts-menu. Here is my menu-config.xml file:
<Menu name="mainMenu" title="" >
<Item name="ecfMenu" title="ECFs" roles="FISCO" location="DisconnectedEcfsSearch" />
<Item name="reportsMenu" title="Relatórios" roles="ADMIN" location="AlarmReportSearch"/>
<Item name="fiscoMenu" title="Fisco" roles="ADMIN" location="UpdateFiscoForm"/>
<Item name="alarmMenu" title="Alarmes" roles="ADMIN" location="AlarmNotification"/>
<Item name="userMenu" title="application.header.users" roles="ADMIN" location="UserSearch"/>
<Item name="consoleMenu" title="Console" roles="FISCO" location="ConsoleSearch"/>
</Menu>
Please notice that I'm trying to use a key to my properties file in the item 'userMenu'. All other items work, but not this one.
Here's my jsp:
<menu:useMenuDisplayer permissions="rolesAdapter" name="Velocity"
config="/WEB-INF/tabs.html">
<menu:displayMenu name="mainMenu" />
</menu:useMenuDisplayer>
I searched around and even found a guy with the same question but there was no response for him. =/
Does anybody know how to make struts-menu recognize that I'm using a key to a properties file and not a literal String??
Thanks!
Try this:
For the menu-config.xml:
<Menu name="mainMenu" title="" >
<Item name="userMenu" title="application.header.users" roles="ADMIN" location="UserSearch"/>
</Menu>
For the JSP:
Use this:
<%# taglib prefix="menu" uri="http://struts-menu.sf.net/tag-el"%>
Instead of this:
<%# taglib prefix="menu" uri="http://struts-menu.sf.net/tag"%>
Invoking the menu:
<menu:useMenuDisplayer bundle="messages" permissions="rolesAdapter" name="Velocity"
config="/WEB-INF/tabs.html">
<menu:displayMenu name="mainMenu" />
</menu:useMenuDisplayer>
For the bundle="messages" provide the name of your resource bundle.
I hope it works for you!