/** @see javax.servlet.jsp.tagext.Tag#doEndTag() */ public int doEndTag() throws JspException { getLogger().debug("TableTag: inizio doEndTag()"); if (isParameterPresent()) { String link; if ((action != null) && !action.equals("")) { // String a=((HttpServletRequest) pageContext.getRequest()).getServletPath(); // String b=((HttpServletRequest) pageContext.getRequest()).getRequestURI(); String contextPath = ((HttpServletRequest) pageContext.getRequest()).getContextPath(); link = contextPath + action; } else { link = ((HttpServletRequest) pageContext.getRequest()).getRequestURI(); } String root = ((HttpServletRequest) pageContext.getRequest()).getContextPath(); boolean showLinkB = showLink == null || !showLink.equals("false"); // se la query è in esecuzione settiamo il flag isLoading anche su TableModel if (paginator.isLoading()) tableModel.setLoading(true); else tableModel.setLoading(false); String contextPath = ((HttpServletRequest) pageContext.getRequest()).getContextPath(); HtmlTableFactory htmlTableFactory; if ((action != null) && (!action.equals(""))) { htmlTableFactory = new HtmlTableFactory( tableModel, styleClass, pageToShow, paginator.getMaxPageNumber(), link, root, showLinkB, textToShow, intestazione, paginator.getElementsFoundNumber(), pageToShowParamName, useSmartLoading, timeToRefresh, contextPath, refreshUrl, true, actionExportExcel, this.paginator.getMaxRowPage(), methodChangeNumElements); } else { htmlTableFactory = new HtmlTableFactory( tableModel, styleClass, pageToShow, paginator.getMaxPageNumber(), link, root, showLinkB, textToShow, intestazione, paginator.getElementsFoundNumber(), pageToShowParamName, useSmartLoading, timeToRefresh, contextPath, refreshUrl, this.paginator.getMaxRowPage(), methodChangeNumElements); } String HTMLCode = htmlTableFactory.getHTMLCode(); // avg PROVA // if (!tableModel.isLoading()){ // ExcelTableFactory excelFactory=new ExcelTableFactory(tableModel); // excelFactory.createExcel(pageContext); // } // fine PROVA // se i dati sono ancora in caricamento // mette in page context la pagina di refresh e il tempo di refresh if (useSmartLoading && this.tableModel.isLoading()) { System.out.println("setto refresh per pager:" + paginator.getAttributeKey()); pageContext.setAttribute("refreshUrl", contextPath + refreshUrl, PageContext.REQUEST_SCOPE); pageContext.setAttribute("timeToRefresh", timeToRefresh, PageContext.REQUEST_SCOPE); // incrementa il numero dei queryExecutor in esecuzione // adesso lo fa il Paginator } else { // decrementa il numero dei queryExecutor in esecuzione // ora lo fa il Paginator } try { pageContext.getOut().print(HTMLCode); } catch (IOException e) { getLogger().error("TableTag::doEndTag()::IOException::" + e.getMessage()); throw new JspTagException("errore scrittura codice HTML"); } } getLogger().debug("TableTag: fine doEndTag()"); return super.doEndTag(); }
/** * @throws javax.servlet.jsp.JspException * @see javax.servlet.jsp.tagext.IterationTag#doAfterBody() */ public int doAfterBody() throws JspException { getLogger().beginMethod("doAfterBody"); if (isParameterPresent()) { try { if (pageToShow < 1) pageToShow = 1; paginator.requestAndStorePage(pageToShow); } catch (Exception e) { e.printStackTrace(); getLogger().error("TableTag::doAfterBody() " + e.getMessage()); // ALEX 02/11/2010 // throw new JspException( e.getMessage() ); JspException je = new JspException(StackTraceUtil.getStackTrace(e)); throw je; } // A che serve questa if ???? // Commento e metto il pezzo di sopra // if (showLink != null && showLink.equals("false")) { // try { // paginator.requestAndStorePage(1); // } catch (Exception e) { // getLogger().error( // "TableTag::doAfterBody() " + e.getMessage()); // } // } else { // try { // paginator.requestAndStorePage(pageToShow); // } catch (Exception e) { // e.printStackTrace(); // getLogger().error( // "TableTag::doAfterBody() " + e.getMessage()); // throw new JspException( e.getMessage() ); // } // } Vector titles = prepareRowTitles(); tableModel.setRowTitles(titles); try { tableModel.setRowsData(prepareRowsData(paginator.getList())); } catch (Exception e) { e.printStackTrace(); getLogger().error(e); getLogger().error("SUGGEST: <<<Make sure that your TO extends InteseTO, please!! >>>"); System.out.println("Exception in doAfterBody:" + e.getMessage()); // System.out.println("SUGGEST: <<< Does your TO extends InteseTO? >>>"); // ALEX ott-2010 // throw new JspException( e.getMessage() ) prima; JspException je = new JspException(StackTraceUtil.getStackTrace(e)); // je.setStackTrace(e.getStackTrace()); throw je; } if (summary != null && !summary.trim().equals("")) { tableModel.setSummary(summary); } else { tableModel.setSummary(getMessageFromRB("message.pagerSummary")); } if (tableModel != null) paginator.passaTableModel(tableModel, columns); } getLogger().endMethod("doAfterBody"); return super.doAfterBody(); }