This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30068
    
149

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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??
 
jQuery in Action, 2nd edition
 
subject: struts menu display problem
 
Similar Threads
Problem finding resources for default web app
Supporting multiple companies in a web application
multiple context problem
problem with webapp directory structure
multiple context problem