my dog learned polymorphism
The moose likes Struts and the fly likes struts menu display problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts menu display problem" Watch "struts menu display problem" New topic

struts menu display problem

Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
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?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32815

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
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="${}"/>


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??
It is sorta covered in the JavaRanch Style Guide.
subject: struts menu display problem
It's not a secret anymore!