Struts menu jsp having problems if being processed after struts action

View: New views
2 Messages — Rating Filter:   Alert me  

Struts menu jsp having problems if being processed after struts action

by dkirvan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using JSP, Struts and sitemesh in several web apps. After signing onto to the system the home page is displayed with the struts menu at top and a navigation menu along the left side of the jsp page. I am using a decorator.jsp to build the completed jsp page. If I click on a menu option or navigation option that calls a struts action class and then processes the new jsp the building of the new jsp fails when it is rebuilding the struts menu jsp. If I click on a link that calls another jsp with out struts action involved then the jsp is built with out any problems.

The error I am receiving is

878756 [http-8080-Processor25] (MessageResourcesMenuDisplayer.java:72) DEBUG net.sf.navigator.displayer.ListMenuDisplayer - Looking up message 'ToDoListMenuProject' in Struts' MessageResources
java.lang.ClassCastException: org.apache.struts.util.PropertyMessageResources
at net.sf.navigator.displayer.MessageResourcesMenuDisplayer.getMessage(MessageResourcesMenuDisplayer.java:76)
at net.sf.navigator.displayer.ListMenuDisplayer.displayComponents(ListMenuDisplayer.java:52)
at net.sf.navigator.displayer.ListMenuDisplayer.display(ListMenuDisplayer.java:41)
at net.sf.navigator.taglib.DisplayMenuTag.doStartTag(DisplayMenuTag.java:100)
at org.apache.jsp.jsp.decorator_jsp._jspx_meth_menu_displayMenu_0(decorator_jsp.java:574)

I have this code in my struts-config

<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig" value="/WEB-INF/menu-config.xml" />
</plug-in>

My menu jsp is
<link href="../../agriStatsStandardLayoutUI/theme/styles.css" rel="stylesheet" type="text/css"/>
<link href="../../agriStatsStandardLayoutUI/jsp/styles/menuDropdown.css" rel="stylesheet" type="text/css"/>

<%@ taglib uri="http://struts-menu.sf.net/tag" prefix="menu" %>
<%@ taglib uri="http://struts-menu.sf.net/tag-el" prefix="menu-el" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>

<%@page import="com.agristats.logonUtility.util.*"%>
<%-- djk 10-01-08
<script type="text/javascript" src="<%= request.getContextPath() %>/jsp/scripts/menuDropdown.js"></script>
--%>
<script type="text/javascript" src="../../agriStatsStandardLayoutUI/jsp/scripts/menuDropdown.js"></script>

<menu:useMenuDisplayer name="ListMenu" bundle="org.apache.struts.action.MESSAGE">

<%
boolean isLogedIn = com.agristats.logonUtility.util.LogonUtility.userLoggedIn(request);
if (isLogedIn){
%>
<menu:displayMenu name="ToDoListMenuProject"/>
<%
}
%>

<%
String listFilter = "";
String AAB = (String)request.getAttribute("listFilter");
if (AAB == null){
}else{
if (AAB == "YES"){
%>
<menu:displayMenu name="ToDoListMenuList"/>
<% }
}
%>


<%
//boolean isLogedIn = com.agristats.logonUtility.util.LogonUtility.userLoggedIn(request);
//String BBB = (String)request.getSession().getAttribute("loggedOn");
//String[] xxx = (String[])request.getSession().getAttribute("empInternalCompanies");
String[] xxx = com.agristats.logonUtility.util.LogonUtility.getEmpInternalCompanies(request);
int zzz = 0;
if (isLogedIn){
zzz = xxx.length;
if (zzz > 1){
%>
<menu:displayMenu name="ToDoListSelectCompany"/>
<% }
}
%>


<menu:displayMenu name="ToDoListMenuLogoff"/>


</menu:useMenuDisplayer>


The menu-config.xml is
<?xml version="1.0" encoding="UTF-8"?>
<MenuConfig>
<Displayers>
<Displayer name="DropDown"
type="net.sf.navigator.displayer.DropDownMenuDisplayer" />
<Displayer name="ListMenu"
type="net.sf.navigator.displayer.ListMenuDisplayer" />
</Displayers>
<Menus>
<Menu name="ToDoListMenuProject" title="Project" description="test"
width="200">
<Item name="TDLteam" title="Team">
<Item name="TDLjohn" title="John"
page="/johnD.do" width="40" />
<Item name="TDLdoug" title="Doug"
page="/dougT.do" width="40" />
<Item name="TDLshirley" title="Shirley"
page="/shirleyS.do" width="40" />
<Item name="TDLdavid" title="David"
page="/jsp/davidK.jsp" width="40" />
</Item>
</Menu>

<Menu name="ToDoListMenuList" title="Filter" width="200">
<Item name="TDLactiveItems" title="Active Items"
page="${filterActive}" width="100" />
<Item name="TDLallItems" title="All Items"
page="${filterAll}" width="100" />
<Item name="TDLdeletedItems" title="Deleted Items"
page="${filterDeleted}" width="150" />
</Menu>

<Menu name="ToDoListSelectCompany" title="Company" width="100">
<Item name="TDLagriStats" title="Agri Stats"
page="/home.do?do=compAgriStats" width="190" />
<Item name="TDLexpressMarkets" title="Express Markets"
page="/home.do?do=compExpressMarkets" width="190" />
</Menu>


<Menu name="ToDoListMenuLogoff" title="Log Out" description="LogOut"
width="200">
<Item name="TDLlogout" title="LOG OUT"
page="/logon.do?do=showLogon" width="100" />
</Menu>

</Menus>
</MenuConfig>

Re: Struts menu jsp having problems if being processed after struts action

by dkirvan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Problem Resolved:
I had to put the struts.jar and struts-menu-2.4.3.jar in the common/lib for tomcat and remove them from the individual web-app's lib directory. In addition, I had to coppy the commons.*.jars to common/lib for tomcat except for the commons.logging.jar which caused problems if removed from the individual web-app's directory.