List of usage examples for javax.servlet.jsp JspException JspException
public JspException(Throwable cause)
JspException
with the specified cause. From source file:com.ultrapower.eoms.common.plugin.ecside.tag.TrTag.java
@Override public int doEndTag() throws JspException { try{/*from w w w . j a v a2 s .c o m*/ if (!TagUtils.isIteratingBody(this)) { if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("top")){ location="Top"; }else if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("before")){ location="Before"; }else if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("After")){ location="After"; } List trList=(List)model.getTable().getAttribute("ExtendTableTrList"+location); if (trList==null){ trList=new ArrayList(); } trList.add(trBean); model.getTable().setAttribute("ExtendTableTrList"+location, trList); } } catch (Exception e) { throw new JspException("TrTag.doEndTag() Problem: " + ExceptionUtils.formatStackTrace(e)); } return super.doEndTag(); }
From source file:com.googlecode.jtiger.modules.ecside.tag.TrTag.java
public int doEndTag() throws JspException { try {/*from w w w. ja v a2s . com*/ if (!TagUtils.isIteratingBody(this)) { if (StringUtils.isBlank(location) || location.equalsIgnoreCase("top")) { location = "Top"; } else if (StringUtils.isBlank(location) || location.equalsIgnoreCase("before")) { location = "Before"; } else if (StringUtils.isBlank(location) || location.equalsIgnoreCase("After")) { location = "After"; } List trList = (List) model.getTable().getAttribute("ExtendTableTrList" + location); if (trList == null) { trList = new ArrayList(); } trList.add(trBean); model.getTable().setAttribute("ExtendTableTrList" + location, trList); } } catch (Exception e) { throw new JspException("TrTag.doEndTag() Problem: " + ExceptionUtils.formatStackTrace(e)); } return super.doEndTag(); }
From source file:com.geemvc.taglib.GeemvcTagSupport.java
protected void appendTagBody(JspWriter writer) throws JspException { try {/*from w w w . j a va 2s . c om*/ if (jspBody != null) jspBody.invoke(writer); } catch (Throwable t) { throw new JspException(t); } }
From source file:ch.entwine.weblounge.taglib.content.ElementTag.java
/** * Sets the element language. If the language is provided, then the element * will be forced with that language and will be treated as non existent, if * it is not available in that language. * /*from w ww . j a va 2 s . c o m*/ * @param value * the element language */ public final void setLanguage(String value) throws JspException { language = LanguageUtils.getLanguage(value); if (language == null) { throw new JspException("Language '" + value + "' does not exist!"); } }
From source file:com.adito.input.tags.FrameTag.java
String generateFragment() throws JspException { String framePosition = CoreUtil.getCookieValue("frame_" + getStyleId() + "_pos", (HttpServletRequest) pageContext.getRequest(), ""); StringBuffer buf = new StringBuffer(); Panel p = panelId == null ? null : PanelManager.getInstance().getPanel(panelId); if (p == null && getStyleId() == null) { throw new JspException("Frame tag requires either panelId or styleId attributes"); }/*from w w w .ja v a 2 s. co m*/ String frameState = CoreUtil.getCookieValue("frame_" + getStyleId(), (HttpServletRequest) pageContext.getRequest(), p != null ? p.getDefaultFrameState() : FRAME_NORMAL); buf.append("<div "); buf.append("id=\""); buf.append(getStyleId()); buf.append("\""); if (getStyleClass() != null) { buf.append(" class=\""); buf.append(getStyleClass()); buf.append("\""); } if (!framePosition.equals("") || frameState.equals(FRAME_CLOSED)) { buf.append(" style=\""); if (!framePosition.equals("")) { try { StringTokenizer t = new StringTokenizer(framePosition, ","); int x = Integer.parseInt(t.nextToken()); int y = Integer.parseInt(t.nextToken()); buf.append("left: "); buf.append(x); buf.append("px; top: "); buf.append(y); buf.append("px;"); } catch (Exception e) { } } if (frameState.equals("closed") && (p == null || p.isCloseable())) { buf.append("display: none;"); } buf.append("\" "); } buf.append(">"); buf.append("<div id=\""); buf.append(getStyleId()); buf.append("Container\""); if (frameState.equals(FRAME_COLLAPSED)) { buf.append(" style=\"position: relative; left: -17.2em\""); } buf.append(">"); if (titleKey != null) { title = TagUtils.getInstance().message(pageContext, getBundle(), getLocale(), titleKey, new String[] {}); } if (title != null && !title.equals("")) { buf.append("<div class=\"titleBar\""); if (p != null && p.isDragable()) { if (p.isDropable()) { buf.append(" onmousedown=\"registerDragAndDrop(event,'"); } else { buf.append(" onmousedown=\"registerDrag(event, \'"); } buf.append(getStyleId()); buf.append("')\""); } buf.append(">"); buf.append("<div class=\"titleInner\">"); if (expander && (p == null || p.isCloseable())) { buf.append("<div class=\"expander\">"); buf.append("<img id=\""); buf.append(getStyleId()); buf.append("_collapse"); buf.append("\" onclick=\"frameCollapse('"); buf.append(getStyleId()); buf.append("');\" src=\""); buf.append(CoreUtil.getThemePath(pageContext.getSession()) + "/images/collapse.gif"); buf.append("\"/>"); buf.append("</div>"); } buf.append("<div class=\""); buf.append(titleClass != null ? titleClass : "title"); buf.append("\""); if (titleId != null) { buf.append(" id=\""); buf.append(titleId); buf.append("\""); } buf.append(">"); buf.append(title); buf.append("</div>"); if (p == null || p.isCloseable() || p.isMinimizable()) { buf.append("<div class=\"actions\">"); if (p == null || p.isMinimizable()) { buf.append("<img id=\""); buf.append(getStyleId()); buf.append("_minimize"); buf.append("\" onclick=\"frameMinimize('"); buf.append(getStyleId()); buf.append("');\" src=\""); buf.append(CoreUtil.getThemePath(pageContext.getSession()) + "/images/minimize.gif"); if (frameState.equals(FRAME_MINIMIZED)) { buf.append("\" style=\"display: none"); } buf.append("\"/>"); buf.append("<img id=\""); buf.append(getStyleId()); buf.append("_restore"); buf.append("\" onclick=\"frameRestore('"); buf.append(getStyleId()); buf.append("');\" src=\""); buf.append(CoreUtil.getThemePath(pageContext.getSession()) + "/images/maximize.gif"); if (frameState.equals(FRAME_NORMAL)) { buf.append("\" style=\"display: none"); } buf.append("\"/>"); } if (p == null || p.isCloseable()) { buf.append("<img id=\""); buf.append(getStyleId()); buf.append("_close"); buf.append("\" onclick=\"frameClose('"); buf.append(getStyleId()); buf.append("');\" src=\""); buf.append(CoreUtil.getThemePath(pageContext.getSession()) + "/images/close.gif"); if (frameState.equals(FRAME_CLOSED)) { buf.append("\" style=\"display: none\""); } buf.append("\"/>"); } if (expander) { buf.append("<img id=\""); buf.append(getStyleId()); buf.append("_expand"); buf.append("\" onclick=\"frameExpand('"); buf.append(getStyleId()); buf.append("');\" src=\""); buf.append(CoreUtil.getThemePath(pageContext.getSession()) + "/images/expand.gif"); if (!frameState.equals(FRAME_COLLAPSED)) { buf.append("\" style=\"display: none"); } buf.append("\"/>"); } buf.append("</div>"); } buf.append("</div>"); buf.append("</div>"); } buf.append("<div class=\"frameContent\">"); buf.append("<div class=\"frameContentContainer\" id=\""); buf.append(getStyleId() + "Content"); if (frameState.equals(FRAME_MINIMIZED)) { buf.append("\" style=\"display: none"); } buf.append("\">"); buf.append(bodyContent.getString()); buf.append("</div>"); buf.append("</div>"); buf.append("</div>"); buf.append("</div>"); if (getStyleId() != null) { buf.append("<script language=\"JavaScript\">addDropTarget('"); buf.append(getStyleId()); buf.append("');</script>"); } return buf.toString(); }
From source file:net.sibcolombia.portal.web.tag.AlphabetLinkTag.java
/** * @see javax.servlet.jsp.tagext.TagSupport#doStartTag() *///from ww w . ja v a 2 s .co m @Override public int doStartTag() throws JspException { Locale locale = RequestContextUtils.getLocale((HttpServletRequest) pageContext.getRequest()); if (letters == null || letters.isEmpty()) { return super.doStartTag(); } StringBuffer sb = new StringBuffer(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String contextPath = request.getContextPath(); List<Character> ignoreChars = new ArrayList<Character>(); if (StringUtils.isNotEmpty(ignores)) { ignores = ignores.trim(); StringTokenizer st = new StringTokenizer(ignores); while (st.hasMoreTokens()) { String ignoreChar = st.nextToken(); if (ignoreChar.length() != 1) { throw new JspException("Invalid ignore list :" + ignoreChar); } ignoreChars.add(new Character(ignoreChar.charAt(0))); } } sb.append("<ul class=\""); sb.append(listClass); sb.append("\">"); sb.append("<li class=\"lt\">"); letters.add(0, '0'); int indexOfSelected = letters.indexOf(selected); if (indexOfSelected > 0) { addLink(sb, contextPath, letters.get(indexOfSelected - 1), "<<"); } else { sb.append("<<"); } sb.append("</li>"); List<String> acceptedChars = Arrays.asList(accepted); for (Character letter : letters) { if (!ignoreChars.contains(letter) && acceptedChars.contains(letter.toString())) { sb.append("<li"); if (!(letter == '0')) { if (selected != letter) { sb.append('>'); addLink(sb, contextPath, letter); } else { sb.append(" id=\"chosen\">"); sb.append(letter); } } else { if (selected != letter) { sb.append('>'); addLink(sb, contextPath, '0', messageSource.getMessage("dataset.list.showall", null, "Todas", locale)); } else { sb.append(" id=\"chosen\">"); sb.append(messageSource.getMessage("dataset.list.showall", null, "Todas", locale)); } } sb.append("</li>"); } } sb.append("<li class=\"lt\">"); if (indexOfSelected < (letters.size() - 1)) { addLink(sb, contextPath, letters.get(indexOfSelected + 1), ">>"); } else { sb.append(">>"); } sb.append("</li>"); sb.append("</ul>"); try { pageContext.getOut().write(sb.toString()); } catch (IOException e) { throw new JspException(e); } return super.doStartTag(); }
From source file:de.laures.cewolf.taglib.tags.ChartMapTag.java
public int doStartTag() throws JspException { // Object linkGenerator = getLinkGenerator(); Mapped root = (Mapped) PageUtils.findRoot(this, pageContext); root.enableMapping();//from w ww .j av a 2s . c o m String chartId = ((CewolfRootTag) root).getChartId(); try { Dataset dataset = PageUtils.getDataset(chartId, pageContext); Writer out = pageContext.getOut(); final boolean isIE = BrowserDetection.isIE((HttpServletRequest) pageContext.getRequest()); if (hasToolTips()) { enableToolTips(out, isIE); } out.write("<MAP name=\"" + chartId + "\">\n"); ChartRenderingInfo info = (ChartRenderingInfo) root.getRenderingInfo(); Iterator entities = info.getEntityCollection().iterator(); while (entities.hasNext()) { ChartEntity ce = (ChartEntity) entities.next(); out.write("\n<AREA shape=\"" + ce.getShapeType() + "\" "); out.write("COORDS=\"" + ce.getShapeCoords() + "\" "); if (ce instanceof XYItemEntity) { dataset = ((XYItemEntity) ce).getDataset(); } if (!(ce instanceof LegendItemEntity)) { if (hasToolTips()) { writeOutToolTip(dataset, out, isIE, ce); } if (hasLinks()) { writeOutLink(linkGenerator, dataset, out, ce); } } out.write(">"); } } catch (IOException ioex) { log.error(ioex); throw new JspException(ioex.getMessage()); } catch (CewolfException cwex) { log.error(cwex); throw new JspException(cwex.getMessage()); } return EVAL_PAGE; }
From source file:com.googlecode.jtiger.modules.ecside.tag.ColumnsTag.java
public int doEndTag() throws JspException { try {/* w ww.ja va 2s. c o m*/ TableModel model = TagUtils.getModel(this); if (!TagUtils.isIteratingBody(this)) { if (StringUtils.isNotBlank(titles)) { String[] titlesA = (" " + titles + " ").split(","); model.getTable().setAttribute(ECSideConstants.TABLE_TITLES_KEY, titlesA); } if (StringUtils.isNotBlank(widths)) { String[] cellWidthsA = (" " + widths + " ").split(","); model.getTable().setAttribute(ECSideConstants.TABLE_WIDTHS_KEY, cellWidthsA); } if (StringUtils.isNotBlank(cellValues)) { String[] cellValuesA = (" " + cellValues + " ").split(","); model.getTable().setAttribute(ECSideConstants.TABLE_CELL_VALUES_KEY, cellValuesA); } // if (StringUtils.isNotBlank(cellNames)){ // String[] cellNamesA=(" "+cellNames+" ").split(","); // model.getTable().setAttribute(ECSideConstants.TABLE_CELLNAMES_KEY,cellNamesA); // } if (StringUtils.isNotBlank(editEvents)) { String[] cellEventsA = (" " + editEvents + " ").split(","); model.getTable().setAttribute(ECSideConstants.TABLE_EDIT_EVENTS_KEY, cellEventsA); } if (StringUtils.isNotBlank(editTemplates)) { String[] cellTemplatesA = (" " + editTemplates + " ").split(","); model.getTable().setAttribute(ECSideConstants.TABLE_EDIT_TEMPLATES_KEY, cellTemplatesA); } if (StringUtils.isNotBlank(editables)) { String[] cellEditablesA = (" " + editables + " ").split(","); model.getTable().setAttribute(ECSideConstants.TABLE_EDITABLES_KEY, cellEditablesA); } String autoGenerateColumns = TagUtils.evaluateExpressionAsString("autoGenerateColumns", this.autoGenerateColumns, this, pageContext); if (StringUtils.isBlank(autoGenerateColumns)) { autoGenerateColumns = TableConstants.DEFAULT_AUTOGENERATECOLUMNS; } model.addColumns(autoGenerateColumns); } else { model.setColumnValues(); } } catch (Exception e) { LogHandler.errorLog(logger, e); throw new JspException("ColumnsTag.doEndTag() Problem: " + ExceptionUtils.formatStackTrace(e)); } finally { } return EVAL_PAGE; }
From source file:com.sun.faces.taglib.jsf_core.ViewTag.java
public int doAfterBody() throws JspException { BodyContent bodyContent = null;// ww w.ja v a 2 s . c om String content = null; FacesContext context = FacesContext.getCurrentInstance(); ResponseWriter responseWriter = context.getResponseWriter(); StateManager stateManager = Util.getStateManager(context); SerializedView view = null; int beginIndex = 0, markerIndex = 0, markerLen = RIConstants.SAVESTATE_FIELD_MARKER.length(), contentLen = 0; // get a writer that sends to the client responseWriter = responseWriter.cloneWithWriter(getPreviousOut()); if (context == null) { throw new JspException(Util.getExceptionMessageString(Util.NULL_CONTEXT_ERROR_MESSAGE_ID)); } context.setResponseWriter(responseWriter); if (null == (bodyContent = getBodyContent())) { Object params[] = { this.getClass().getName() }; throw new JspException(Util.getExceptionMessageString(Util.NULL_BODY_CONTENT_ERROR_MESSAGE_ID, params)); } content = bodyContent.getString(); try { view = stateManager.saveSerializedView(context); } catch (IllegalStateException ise) { throw new JspException(ise); } catch (Exception ie) { // catch any exception thrown while saving the view in session. Object[] params = { "session", ie.getMessage() }; throw new JspException(Util.getExceptionMessageString(Util.SAVING_STATE_ERROR_MESSAGE_ID, params), ie); } try { contentLen = content.length(); do { // if we have no more markers if (-1 == (markerIndex = content.indexOf(RIConstants.SAVESTATE_FIELD_MARKER, beginIndex))) { // write out the rest of the content responseWriter.write(content.substring(beginIndex)); } else { // we have more markers, write out the current chunk responseWriter.write(content.substring(beginIndex, markerIndex)); stateManager.writeState(context, view); beginIndex = markerIndex + markerLen; } } while (-1 != markerIndex && beginIndex < contentLen); } catch (IOException iox) { // catch any thrown while saving state in response. Object[] params = { "client", iox.getMessage() }; throw new JspException(Util.getExceptionMessageString(Util.SAVING_STATE_ERROR_MESSAGE_ID, params), iox); } return EVAL_PAGE; }
From source file:net.mlw.vlh.web.tag.DefaultRowTag.java
/** * @see javax.servlet.jsp.tagext.Tag#doStartTag() *//*from ww w . j av a2 s. c o m*/ public int doStartTag() throws JspException { init(); // If the valuelist is empty, render only header ValueList valueList = getRootTag().getValueList(); if (valueList == null || valueList.getList() == null || valueList.getList().size() == 0) { getRootTag().setValueList(ValueListNullSpacer.getInstance()); LOGGER.warn("ValueList '" + getRootTag().getTableInfo().getName() + "' is empty or null. Continue working with the singleton ValueListNullSpacer."); } if (getDisplayProvider().getMimeType() != null) { try { pageContext.getResponse().setContentType(getDisplayProvider().getMimeType()); } catch (Exception e) { LOGGER.error("DefaultRowTag.doStartTag() exception...", e); throw new JspException(e); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Starting procesing rows of the table '" + getRootTag().getTableInfo().getId() + "' with the ValueList '" + getRootTag().getTableInfo().getName() + "'."); } processIteration(); return EVAL_BODY_AGAIN; }