在struts 2中,第二次动作不是火

时间:2014-01-16 09:43:35

标签: java javascript struts2

当我第一次提交按钮时,它会点击动作(其工作正常)。但是当我第二次提交按钮时,它不会点击动作并显示长堆栈竞赛错误消息。  这里有我的错误和代码

JSP中的

<s:select id="ddlStatus" cssClass="form-control input-sm" list="statusList" name="selectedStatus" listKey="entityId" listValue="entityName" />

<s:submit id="btnSearch" value="Search" cssClass="btn btn-default btn-sm" action="search" method="search"></s:submit>
struts config中的

动作

<action name="search" class="com.SearchAction"
            method="search">
            <result name="success" type="tiles">search</result>
            <result name="input" type="tiles">search</result>
</action>

行动方法

public String search() {
    dosearch();
    populateList(); // populate list method will populate statusList 
    return "success";
}

private List<CommonEntity> statusList;
private String selectedStatus;

这是错误回复

根本原因

tag 'select', field 'list', name 'selectedStatus': The requested list key 'statusList' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]


org.apache.struts2.components.Component.fieldError(Component.java:230)
        org.apache.struts2.components.Component.findValue(Component.java:351)
        org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
        org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
        org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856)
        org.apache.struts2.components.UIBean.end(UIBean.java:510)
        org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
        org.apache.jsp.views.search_jsp._jspx_meth_s_005fselect_005f0(search_jsp.java:1238)
        org.apache.jsp.views.search_jsp._jspx_meth_s_005fform_005f0(search_jsp.java:774)
        org.apache.jsp.views.search_jsp._jspService(search_jsp.java:181)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
        org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
        org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
        org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:80)
        org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:73)
        org.apache.tiles.context.TilesRequestContextWrapper.dispatch(TilesRequestContextWrapper.java:72)
        org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesRequestContext.java:88)
        org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:283)
        org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:140)
        org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:117)
        org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport.java:154)
        org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecurityTagSupport.java:75)
        org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTagSupport.java:80)
        org.apache.jsp.views.shared.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f2(layout_jsp.java:176)
        org.apache.jsp.views.shared.layout_jsp._jspService(layout_jsp.java:100)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:198)
        org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:179)
        org.apache.tiles.context.TilesRequestContextWrapper.dispatch(TilesRequestContextWrapper.java:72)
        org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesRequestContext.java:88)
        org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:606)
        org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)
        org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
        org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
        com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
        com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
        org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        com.interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:46)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
        org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
        org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
        com.filters.EncodingFilter.doFilter(EncodingFilter.java:106)

注意Apache Tomcat/7.0.42日志中提供了根本原因的完整堆栈跟踪。

我的建议    我无法填充statusList,因为操作不会出现

我找不到理由(动作没有第二次被击中

1 个答案:

答案 0 :(得分:0)

似乎'statusList'为null。请检查populateList()方法中'statusList'的值。还要检查是否为'statusList'创建了getter和setter,因为它是一个成员变量