Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts menu display problem" Watch "struts menu display problem" New topic
Author

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?

Thanks,
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32501
    
214

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.


[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="${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??
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: struts menu display problem
 
It's not a secret anymore!