IE 11浏览器后退按钮抛出NullPointerException

时间:2019-07-08 10:16:09

标签: internet-explorer struts2 back

我正在开发基于Struts 2的应用程序,该应用程序在Chrome和Mozilla firefox中运行良好,但是在IE 11中发生了什么,当我按下IE的后退按钮时,它首先显示了如下所示的异常

 org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp/ComparativeSiteAnalysis.jsp at line 97

94:     <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
95:       <tr>
96:         <td width="19%" class="chart_head_1">&nbsp;</td>
97:         <td width="81%" colspan="7" class="chart_head_1"><%=((String)request.getAttribute("divName")).replace(" ","&nbsp;")%> <%= manager.getValue(langSelected+AppConstants.HEADING_COMPARATIVE_CHART) %></td>
98:        <td align="right" ><a href="#" onclick="back();" class="back_link"><img src="./images/Right Arrow.png" width="12" height="12" border="0" />&nbsp;<%= manager.getValue(langSelected+AppConstants.BACK) %></a></td></tr>
99:       <tr>
100:         <td class="chart_head_2" colspan="9">


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
    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.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
    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.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    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)
    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)
    org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)



root cause 
java.lang.NullPointerException
    org.apache.jsp.jsp.ComparativeSiteAnalysis_jsp._jspService(ComparativeSiteAnalysis_jsp.java:214)
    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)

后退代码

   @Override
    public String getComparativeSiteAnalysis(Integer divId, String lang, int selectedYear) {
        // System.out .println("getComparativeSiteAnalysis lang="+lang);
        maxSizeSiteName = "";
        if (divId != null) {
            List<Frequency> freqList = null;
            List<Site> sites = null;
            int year = -1;
            try {
                //PLEANTY OF CODE
            } catch (CustomException e) {

                logger.error("Error in getComparativeSiteAnalysis Method", e);
            }
            if (sites == null || sites.isEmpty()) {
                return "";
            }
            dataCount = sites.size();
            // System.out.println("dataCount:"+dataCount);
            List<String> colList = new ArrayList<String>();


            Collections.sort(sites, new UniversalComparator("isStatus", 1));

            for (Iterator<Site> iterator = sites.iterator(); iterator.hasNext();) {
                site = iterator.next();
                if (site.getName().length() > maxSizeSiteName.length()) {
                    maxSizeSiteName = site.getName();
                }
                int naSiteDataCount = 0;
                logger.debug("SITE NAME===>>" + site.getName());
                Utility.getInstance().computeSite(site, true, null, false, null, year);

                // System.out.println(" sitename: "+site.getName()+" semi annual compliance:
                // "+site.getSemiAnnualCompliance());

                String link = "JavaScript:getSiteWiseMonthlyChapterAnalysis('"
                        + StringEscapeUtils.escapeXml(site.getName()) + "'," + site.getId() + ","
                        + manager.getValue(AppConstants.MONTHLY) + ",'" + monthlyFreqName + "')";

                rowList.add(site.getName());
                siteComparativeChart = utility.addHeapMapDataSetNode(site.getName(), monthlyFreqName,
                        String.valueOf(roundTwoDecimals(site.getMonthlyCompliance())), link, siteComparativeChart,
                        site.getComparativeColorMonthly());
                int monthlyDataCount = site.getComparativeColorMonthly().equalsIgnoreCase("White") ? 1 : 0;

                link = "JavaScript:getSiteWiseQuarterlyChapterAnalysis('" + StringEscapeUtils.escapeXml(site.getName())
                        + "'," + site.getId() + "," + manager.getValue(AppConstants.QUATERLY) + ",'" + quaterlyFreqName
                        + "')";

                siteComparativeChart = utility.addHeapMapDataSetNode(site.getName(), quaterlyFreqName,
                        String.valueOf(roundTwoDecimals(site.getQuarterlyCompliance())), link, siteComparativeChart,
                        site.getComparativeColorQuarterly());
                int quaterlyDataCount = site.getComparativeColorQuarterly().equalsIgnoreCase("White") ? 1 : 0;

                link = "JavaScript:getSiteWiseSemiAnnualChapterAnalysis('" + StringEscapeUtils.escapeXml(site.getName())
                        + "'," + site.getId() + "," + manager.getValue(AppConstants.SEMI_ANNUAL) + ",'"
                        + semiAnnualFreqName + "')";

                siteComparativeChart = utility.addHeapMapDataSetNode(site.getName(), semiAnnualFreqName,
                        String.valueOf(roundTwoDecimals(site.getSemiAnnualCompliance())), link, siteComparativeChart,
                        site.getComparativeColorSemiAnnual());
                int semiAnnualDataCount = site.getComparativeColorSemiAnnual().equalsIgnoreCase("White") ? 1 : 0;

                link = "JavaScript:getSiteWiseAnnualChapterAnalysis('" + StringEscapeUtils.escapeXml(site.getName())
                        + "'," + site.getId() + "," + manager.getValue(AppConstants.ANNUAL) + ",'" + annualFreqName
                        + "')";

                siteComparativeChart = utility.addHeapMapDataSetNode(site.getName(), annualFreqName,
                        String.valueOf(roundTwoDecimals(site.getAnnualCompliance())), link, siteComparativeChart,
                        site.getComparativeColorAnnual());

                int annualDataCount = site.getComparativeColorAnnual().equalsIgnoreCase("White") ? 1 : 0;
                naSiteDataCount = monthlyDataCount + quaterlyDataCount + semiAnnualDataCount + annualDataCount;
                naSiteDataList.add(naSiteDataCount);
                naSiteCounter.add(naSiteDataCount);
                site.setNaSiteCount(naSiteDataList);
                site.setNaSiteCounter(naSiteCounter);
                System.out.println("datacount is" + naSiteDataCount);
            }
//          Collections.sort(sites, new UniversalComparator("getNaSiteCount", 1));
            for (Integer count : site.getNaSiteCount()) {
                System.out.println("ALL NA COUNT" + count);
            }
            for (Integer count1 : site.getNaSiteCounter()) {
                System.out.println("ALL NA COUNT" + count1);
            }
            this.maxSizeSiteName = maxSizeSiteName.replaceAll(" ", ".");
            this.maxSizeSiteName = maxSizeSiteName.replaceAll("-", ".");
            String xml = utility.getHeapMapXML1(manager.getValue(lang + AppConstants.LABEL_FREQUENCY),
                    divisionName + "-" + manager.getValue(lang + AppConstants.LABEL_SITES), colList, rowList, "0",
                    siteComparativeChart);
            return xml;
        }
        return "";

    }

当我点击浏览器的后退按钮时,上面的方法被调用,我发现if (divId != null)实际上返回了null,它变成了false,因此变成了return ""

再打一次,它呈现页面,我无法弄清楚到底是什么问题,实际上我在Opera,safari,chrome和mozilla中运行了我的应用程序,没有一个浏览器显示出如此令人恶心的异常

这是浏览器的问题吗 我该如何纠正? 任何帮助表示赞赏

0 个答案:

没有答案