当我执行我的应用程序时,我有一个错误。
问题不是来自错误版本的taglib?
错误:
引起:javax.servlet.ServletException: javax.servlet.jsp.JspException:'menu.jsp'中的ServletException: javax.servlet.jsp.JspException:无法为此创建迭代器 集合
我的菜单填充在我的java应用程序中:
我的JSP:
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic"%>
<%@ taglib tagdir="/WEB-INF/tags/" prefix="customTag"%>
<customTag:OverlayEntry id="overlaymenu" function="overlaymenu" />
<script type="text/javascript"
src="<html:rewrite page="/javascript/jquery.easing.js"/>"></script>
<script type="text/javascript"
src="<html:rewrite page="/javascript/jquery.accordion.js"/>"></script>
<link href="<html:rewrite page="/css/menu.css"/>" rel="stylesheet"
type="text/css" />
<logic:present name="UserSession" property="menu">
<ul id="navigation">
<logic:iterate id="t" collection="${UserSession.menu.menuEntries}"
indexId="idx">
<customTag:MenuEntry
entry="<%=(com.sodifrance.apex.presentation.generic.session.MenuEntry) t%>" />
</logic:iterate>
</ul>
</logic:present>
<script type="text/javascript">
jQuery('.current').parent().parent().prev('A').addClass('selected');
jQuery('#navigation>li>A[href]').addClass('head2');
jQuery('#navigation').Accordion({
header : '.head',
navigation : false,
event : 'click',
autoheight : false,
animated : false,
active : '.selected',
selectedClass : 'selected',
alwaysOpen : true
});
jQuery('#navigation>li>A.current').addClass('currentHead').removeClass(
'current');
</script>
我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>APP</display-name>
<description>Application</description>
<filter>
<filter-name>applicationFilter</filter-name>
<filter-class>com.presentation.generic.security.ApplicationFilter</filter-class>
<init-param>
<param-name>exclusions</param-name>
<param-value>/generic/authentification/Login.do,
/generic/authentification/login_action.do,
/generic/authentification/Disconnect.do,
*.js,
*.css,
*.jpg,
*.gif,
*.png,
*.ico
</param-value>
</init-param>
<init-param>
<param-name>loginUrl</param-name>
<param-value>/generic/authentification/Login.do</param-value>
</init-param>
</filter>
<filter>
<filter-name>EncodingFilter</filter-name>
<filter-class>com.presentation.generic.security.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>ISO-8859-15</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>applicationFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>EncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<listener>
<listener-class>com.presentation.generic.back.BirtEngineListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>initDB</servlet-name>
<servlet-class>com.metier.init.DbInitializerServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>birtEngineServlet</servlet-name>
<servlet-class>com.report.generic.BirtServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- <servlet-mapping> -->
<!-- <servlet-name>jsp</servlet-name> -->
<!-- <url-pattern>/javascript/generic/messages.js</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- <servlet-mapping> -->
<!-- <servlet-name>jsp</servlet-name> -->
<!-- <url-pattern>*.css</url-pattern> -->
<!-- </servlet-mapping> -->
<servlet-mapping>
<servlet-name>initDB</servlet-name>
<url-pattern>/initDB</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
行动类:
公共ActionForward logInApplication_loginAction(ActionMapping映射,ActionForm表单,HttpServletRequest请求,HttpServletResponse响应)抛出Exception { ActionForward actionForward = null; if(form!= null){ LoginAction returnCode; LoginForm currentForm =(LoginForm)表单; //在退出当前页面时执行代码 currentForm.onExit();
UserSession session = null;
AccueilForm accueilForm = new AccueilForm();
if (validateLogin(currentForm, request)) {
session = new UserSession();
SessionHelper.getDefault().registerSession(session);
initializeUserSession(currentForm, session);
returnCode = LoginAction.LOGIN_SUCCESS;
} else {
ActionErrors e = new ActionErrors();
e.add("property", new ActionMessage("authentification.Login.action.login.failed", Math.floor(Math.random() * 4)));
addErrors(request, e);
returnCode = LoginAction.LOGIN_FAIL;
}
switch (returnCode) {
case LOGIN_FAIL:
request.setAttribute(LoginForm.BEAN_NAME,currentForm);
// execute code on entry of next page
currentForm.onEntry();
actionForward = mapping.findForward("LOGINACTION_LOGIN_FAIL");
break;
case LOGIN_SUCCESS:
session.setLogin(currentForm.getLogin());
request.getSession().setAttribute("UserSession", session);
accueilForm.onEntry();
request.setAttribute(AccueilForm.BEAN_NAME, accueilForm);
actionForward = mapping.findForward("LOGINACTION_LOGIN_SUCCESS");
break;
default:
break;
}
}
return actionForward;
}
我的配置:
答案 0 :(得分:1)
您在struts标记中使用EL的问题,这是不期望的。
<logic:notEmpty name="UserSession" property="menu">
<bean:define id="menuInfo" name="UserSession" property="menu"/>
<ul id="navigation">
<logic:iterate id="t" name="menuInfo" property="menuEntries" type="com.example.MenuEntry">
...