• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts menu display problem

 
Vicky Pandya
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented struts database menu, which loads items dynamically from db. i have struts-menu jar file in my web context (WEB-INF/lib). building of menu is not a problem but 1)menu is always expanded with no stylesheet or javascript attached to it. I have required css, js files in my web context. do i need to do anything extra for JS and CSS?

Thanks,
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33684
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vicky,
Do you have the javascript and css tags included in the JSP? You can verify this by checking the generated HTML after it is rendered in the web browser.
 
Vicky Pandya
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. I do have everything included in my jsp. I found that I wasn't putting <script> </script> block around. But now after having script block around menu:useMenuDisplayer tag I get javascript error for following code in jsp.

script type="text/javascript">
<menu:useMenuDisplayer name="Velocity" config="/templates/xtree.html" repository="repository">
<c:forEach var="menu" items="${repository.topMenus}">
<menu-el isplayMenu name="${menu.name}"/>
</c:forEach>

</menu:useMenuDisplayer>
</script>

I get error because of the way above script generates Menu names. I have long menu names like "Element name abc" meaning I have spaces in the names of menu elements. When I do view source it shows me generated javascript names as "var Element name abc = ..." This isn't right as it should be
"var Elementnameabc = ....". I thought this should be taken care by included scripts.
<LINK REL="stylesheet" HREF="../styles/xtree.css">
<LINK REL="stylesheet" HREF="../styles/menuExpandable.css">
<LINK REL="stylesheet" HREF="../styles/menuDropdown.css">
<LINK REL="stylesheet" HREF="../styles/global.css">
<SCRIPT LANGUAGE="JavaScript" SRC="../scripts/xtree.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="../scripts/menuDropdown.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="../scripts/menuExpandable.js"></SCRIPT>

Also database menu example on struts menu site does generate variable names without spaces. I wonder why it doesn't in my case??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic