List of usage examples for javax.servlet.jsp JspException JspException
public JspException(Throwable cause)
JspException
with the specified cause. From source file:org.onebusaway.nyc.webapp.actions.wiki.IndexAction.java
@Override public String execute() throws Exception { if (namespace == null || namespace.isEmpty()) { namespace = "Main"; }/*from w ww. j av a2 s.c o m*/ if (name == null || name.isEmpty()) { name = "Index"; } if (namespace != null && name != null) { // try to get TOC page for this namespace try { NycWikiPageWrapper page = new NycWikiPageWrapper( _wikiDocumentService.getWikiPage(namespace, "TOC", forceRefresh)); if (page.pageExists()) { toc = _wikiRenderingService.renderPage(page); hasToc = true; } else { toc = null; hasToc = false; } } catch (Exception ex) { toc = null; hasToc = false; } if (this.isAdmin()) { // try to get admin TOC page for this namespace try { NycWikiPageWrapper adminPage = new NycWikiPageWrapper( _wikiDocumentService.getWikiPage(namespace, "AdminTOC", forceRefresh)); if (adminPage.pageExists()) { adminToc = _wikiRenderingService.renderPage(adminPage); hasToc = true; } else { adminToc = null; } } catch (Exception ex) { adminToc = null; } } else { adminToc = null; } // content for page try { NycWikiPageWrapper page = new NycWikiPageWrapper( _wikiDocumentService.getWikiPage(namespace, name, false)); if (page.pageExists()) { content = _wikiRenderingService.renderPage(page); editLink = _wikiRenderingService.getEditLink(page); title = page.getTitle(); lastModifiedTimestamp = page.getLastModified(); } else { content = null; editLink = null; title = null; lastModifiedTimestamp = null; return "NotFound"; } } catch (Exception ex) { throw new JspException(ex); } } return SUCCESS; }
From source file:com.xhsoft.framework.common.page.WebappPageTag.java
/** * <p>Description: build up selecter and print</p> * @param request //from w w w . j av a2 s .co m * @param limit * @return void * @author wenzhi * @version 1.0 * @exception JspException */ @SuppressWarnings("unused") private void buildSelecter(HttpServletRequest request, int limit) throws JspException { try { JspWriter out = pageContext.getOut(); if (StringUtils.isEmpty(pageSizeList)) { pageSizeList = INIT_PAGE_SIZE_LIST; } String[] pageSizes = pageSizeList.split(","); String outString = "?<select name=\"pageSizeSelect\" onchange=\"setLimit(this.value,'" + targets + "')\">"; for (int i = 0; i < pageSizes.length; i++) { if (limit == Integer.parseInt(pageSizes[i])) { outString += "<option selected value=\"" + pageSizes[i] + "\">" + pageSizes[i] + "</option>"; } else { outString += "<option value=\"" + pageSizes[i] + "\">" + pageSizes[i] + "</option>"; } } outString += "</select>"; out.print(outString); } catch (Exception e) { throw new JspException(e); } }
From source file:gov.nih.nci.ncicb.cadsr.common.jsp.tag.handler.RefDocAltQuestionTextDisplay.java
public int doStartTag() throws javax.servlet.jsp.JspException { HttpServletRequest req;/* ww w .j av a2s . c o m*/ JspWriter out; try { req = (HttpServletRequest) pageContext.getRequest(); out = pageContext.getOut(); Question currQuestion = (Question) pageContext.getAttribute(questionBeanId); String longName = currQuestion.getLongName(); DataElement de = currQuestion.getDataElement(); if (de != null) { List refDocs = de.getRefereceDocs(); if (refDocs != null && !refDocs.isEmpty()) { List<ReferenceDocument> matchingDocs = ReferenceDocUtil.getReferenceDocsByType(refDocs, refDocType); if (!matchingDocs.isEmpty()) { if (matchingDocs.size() < 2) { // Generate Hyper link String itemIdentifierPrefix = "questionOptionHyperLink" + refDocType; ReferenceDocument currDoc = (ReferenceDocument) matchingDocs.get(0); String displayString = currDoc.getDocText(); if (displayString != null && displayString.length() > 0) { displayString = StringUtils.strReplace(displayString, "'", "\\'"); displayString = StringUtils.strReplace(displayString, "\"", """); } StringBuffer linkStr = new StringBuffer( "<a href=\"javascript:" + hyperLinkJSFunctionName + "('" + htmlObjectRef + "','" + displayString + "')\">"); linkStr.append(currDoc.getDocText()); linkStr.append("</a>"); //out.print(script); out.print(linkStr.toString()); } else { //Generate Multi select box String itemIdentifier = "questionOptions" + questionIndex + refDocType; StringBuffer buffer = new StringBuffer("<select name=\"" + itemIdentifier + "\" id=\"" + itemIdentifier + "\" size=\"" + selectBoxSize + "\" class=\"" + selectBoxClassName + "\"" + "onDblClick=\"" + selectBoxJSFunctionName + "('" + itemIdentifier + "','" + htmlObjectRef + "')\">"); for (ReferenceDocument currDoc : matchingDocs) { String displayString = (currDoc).getDocText(); if (displayString != null && displayString.length() > 0) { displayString = StringUtils.strReplace(displayString, "\"", """); } buffer.append("<option value=\"" + displayString + "\">" + (currDoc).getDocText() + "</option>"); } buffer.append("</select>"); out.print(buffer.toString()); } } } } } catch (Exception ioe) { throw new JspException("I/O Error : " + ioe.getMessage()); } //end try/catch return Tag.SKIP_BODY; }
From source file:com.googlecode.jtiger.modules.ecside.tag.TableTag.java
public int doEndTag() throws JspException { model.getTable().setAttribute(TableConstants.EXTEND_ATTRIBUTES, getExtendAttributesAsString()); try {//from ww w . ja v a 2s . c o m pageContext.getOut().println(model.getViewData()); } catch (Exception e) { // LogHandler.errorLog(logger, msg); throw new JspException("TableTag.doEndTag() Problem: " + ExceptionUtils.formatStackTrace(e)); } finally { doFinally(); } return EVAL_PAGE; }
From source file:com.glaf.core.tag.TagUtils.java
/** * Retrieves the value from request scope and if it isn't already an * <code>ViewMessages</code>, some classes are converted to one. * //from w ww. j a v a 2s . c o m * @param pageContext * The PageContext for the current page * @param paramName * Key for parameter value * @return ActionErrors in page context. * @throws JspException */ public ViewMessages getViewMessages(PageContext pageContext, String paramName) throws JspException { ViewMessages am = new ViewMessages(); Object value = pageContext.findAttribute(paramName); if (value != null) { try { if (value instanceof String) { am.add(ViewMessages.GLOBAL_MESSAGE, new ViewMessage((String) value)); } else if (value instanceof String[]) { String[] keys = (String[]) value; for (int i = 0; i < keys.length; i++) { am.add(ViewMessages.GLOBAL_MESSAGE, new ViewMessage(keys[i])); } } else if (value instanceof ViewMessages) { am = (ViewMessages) value; } else { throw new JspException(messages.getMessage("viewMessages.errors", value.getClass().getName())); } } catch (JspException e) { throw e; } catch (Exception e) { log.warn("Unable to retieve ViewMessage for paramName : " + paramName, e); } } return am; }
From source file:com.healthcit.cacure.web.tag.AnswerPresenterTag.java
@Override public int doStartTag() throws JspException { try {//from ww w . ja v a 2 s .co m FormElement fe = formElement; if (formElement instanceof LinkElement) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(pageContext.getServletContext()); fe = ctx.getBean(QuestionAnswerManager.class).getFantom(fe.getId()); } String controlHtml = ""; // TABLE Questions if (fe.isTable()) { controlHtml = processComplexControls(fe); } //Non-TABLE Questions else { Answer.AnswerType[] array = new Answer.AnswerType[] { AnswerType.TEXT, AnswerType.NUMBER, AnswerType.INTEGER, AnswerType.POSITIVE_INTEGER, AnswerType.DATE, AnswerType.YEAR, AnswerType.MONTHYEAR, AnswerType.CHECKBOX, AnswerType.RADIO, AnswerType.DROPDOWN, AnswerType.TEXTAREA }; if (ArrayUtils.contains(array, fe.getAnswerType())) { /* * At this point we will be in this method only if * FormElement is either QuestionElement, * ExternalQuestionElement or LinkElement that is linked to * one of the above */ List<? extends BaseQuestion> questions = fe.getQuestions(); if (questions != null && questions.size() > 0) { BaseQuestion question = questions.get(0); controlHtml = processSimpleControls(fe, question.getAnswer()); } } else { throw new JspException("Ansert type '" + fe.getAnswerType() + "' is not handled. Please see '" + this.getClass().getSimpleName() + "' to verify"); } } pageContext.getOut().print(controlHtml); } catch (IOException ioe) { throw new JspTagException("Error: IOException while writing to the user"); } return SKIP_BODY; }
From source file:com.xhsoft.framework.common.page.PageTag.java
/** * <p>Description:build up selecter and print</p> * @param request /*from www . j a v a 2 s . c om*/ * @param limit * @return void * @author wenzhi * @version 1.0 * @exception JspException */ private void buildSelecter(HttpServletRequest request, int limit) throws JspException { try { JspWriter out = pageContext.getOut(); if (StringUtils.isEmpty(pageSizeList)) { pageSizeList = INIT_PAGE_SIZE_LIST; } String[] pageSizes = pageSizeList.split(","); String outString = "?<select name=\"pageSizeSelect\" onchange=\"setLimit(this.value,'" + targets + "')\">"; for (int i = 0; i < pageSizes.length; i++) { if (limit == Integer.parseInt(pageSizes[i])) { outString += "<option selected value=\"" + pageSizes[i] + "\">" + pageSizes[i] + "</option>"; } else { outString += "<option value=\"" + pageSizes[i] + "\">" + pageSizes[i] + "</option>"; } } outString += "</select>"; out.print(outString); } catch (Exception e) { throw new JspException(e); } }
From source file:net.mlw.vlh.web.util.JspUtils.java
public static Tag getParent(Tag self, Class klass) throws JspException { Tag tag = self.getParent();/*from w w w . jav a2 s . c om*/ while (!(klass.isAssignableFrom(tag.getClass()))) { tag = tag.getParent(); if (tag == null) { final String message = "Parent tag of class " + klass + " of the tag's class " + self + " was not found."; LOGGER.error(message); throw new JspException(message); } } return tag; }
From source file:com.germinus.easyconf.taglib.PropertyTag.java
/** * Retrieve the required property and expose it as a scripting variable. * * @exception JspException if a JSP exception has occurred *///from www. j a va2s .c om public int doEndTag() throws JspException { Object value = null; ComponentProperties conf = EasyConf.getConfiguration(component).getProperties(); value = readProperty(conf); if (value == null) { JspException e = new JspException("The value of the property is null"); RequestUtils.saveException(pageContext, e); throw e; } pageContext.setAttribute(id, value); return (EVAL_PAGE); }
From source file:alpha.portal.webapp.taglib.ConstantsTag.java
/** * Converts the scope name into its corresponding PageContext constant * value./* w w w . ja v a 2s . com*/ * * @param scopeName * Can be "page", "request", "session", or "application" in any * case. * @return The constant representing the scope (ie. * PageContext.REQUEST_SCOPE). * @throws JspException * if the scopeName is not a valid name. */ public int getScope(final String scopeName) throws JspException { final Integer scope = ConstantsTag.SCOPES.get(scopeName.toLowerCase()); if (scope == null) throw new JspException("Scope '" + scopeName + "' not a valid option"); return scope; }