当前位置: 首页>>代码示例>>Java>>正文


Java JspException类代码示例

本文整理汇总了Java中javax.servlet.jsp.JspException的典型用法代码示例。如果您正苦于以下问题:Java JspException类的具体用法?Java JspException怎么用?Java JspException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JspException类属于javax.servlet.jsp包,在下文中一共展示了JspException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMultipleHeaders

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Expose an array of header values.
 * @throws JspException
 * @since Struts 1.2
 */
protected void handleMultipleHeaders() throws JspException {
    ArrayList values = new ArrayList();
    Enumeration items =
        ((HttpServletRequest) pageContext.getRequest()).getHeaders(name);
        
    while (items.hasMoreElements()){
        values.add(items.nextElement());
    }
        
    if (values.isEmpty() && (this.value != null)){
        values.add(this.value);
    }
        
    String headers[] = new String[values.size()];
    if (headers.length == 0) {
        JspException e =
            new JspException(messages.getMessage("header.get", name));
        TagUtils.getInstance().saveException(pageContext, e);
        throw e;
    }
    
    pageContext.setAttribute(id, values.toArray(headers));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:HeaderTag.java

示例2: processNestedTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Process nested ≶putList> tag.
 * Method is called from nested ≶putList> tags.
 * Nested list is added to current list.
 * If role is defined, nested attribute is wrapped into an untyped definition
 * containing attribute value and role.
 */
public void processNestedTag(PutListTag nestedTag) throws JspException {
    // Get real value and check role
    // If role is set, add it in attribute definition if any.
    // If no attribute definition, create untyped one and set role.
    Object attributeValue = nestedTag.getList();

    if (nestedTag.getRole() != null) {
        AttributeDefinition def = new UntypedAttribute(attributeValue);
        def.setRole(nestedTag.getRole());
        attributeValue = def;
    }

    // Check if a name is defined
    if (nestedTag.getName() == null) {
        throw new JspException("Error - PutList : attribute name is not defined. It is mandatory as the list is added to a 'definition'.");
    }

    // now add attribute to enclosing parent (i.e. : this object).
    putAttribute(nestedTag.getName(), attributeValue);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:DefinitionTag.java

示例3: doStartTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Overriding method of the heart of the tag. Gets the relative property
 * and tells the JSP engine to evaluate its body content.
 *
 * @return int JSP continuation directive.
 */
public int doStartTag() throws JspException {
  // set the original property
  originalProperty = property;

  HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
  String nesting = NestedPropertyHelper.getAdjustedProperty(request, property);

  if (id != null) {
    // use it as a scripting variable instead
    pageContext.setAttribute(id, nesting);

  } else {
    /* write output, filtering if required */
    if (this.filter) {
      TagUtils.getInstance().write(pageContext, TagUtils.getInstance().filter(nesting));
    } else {
      TagUtils.getInstance().write(pageContext, nesting);
    }
  }

  /* continue with page processing */
  return (SKIP_BODY);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:NestedWriteNestingTag.java

示例4: retrieveFormatString

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Retrieve format string from message bundle and return null if
 * message not found or message string.
 *
 * @param formatKey value to use as key to search message in bundle
 * @exception JspException if a JSP exception has occurred
 */
protected String retrieveFormatString(String formatKey) throws JspException {
    String result =
        TagUtils.getInstance().message(
            pageContext,
            this.bundle,
            this.localeKey,
            formatKey);

    if ((result != null)
        && !(result.startsWith("???") && result.endsWith("???"))) {

        return result;

    } else {
        return null;
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:WriteTag.java

示例5: doStartTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Overriding to allow the chance to set the details of the system, so that
 * dynamic includes can be possible
 * @return int JSP continuation directive.
 */
public int doStartTag() throws JspException {
  // store original result
  int temp = super.doStartTag();

  HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
  // original nesting details
  originalNesting = NestedPropertyHelper.getCurrentProperty(request);
  originalNestingName = NestedPropertyHelper.getCurrentName(request, this);

  // some new details
  NestedPropertyHelper.setProperty(request, null);
  NestedPropertyHelper.setName(request, super.getBeanName());

  // continue
  return temp;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:NestedFormTag.java

示例6: otherDoStartTagOperations

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/** Make sure tag is within a form
 */
public void otherDoStartTagOperations()  {
    if (log.isDebugEnabled())
        log.debug(this.NAME+".otherDoStartTagOperations: START");
    
    try {
        super.otherDoStartTagOperations();
    } catch (JspException e) {
        log.error(this.NAME+".otherDoStartTagOperations: error: " + e, e);
    }
    
    if (log.isDebugEnabled())
        log.debug(this.NAME+".otherDoStartTagOperations: m_containsContent=" + m_containsContent);
    
    // Preprocess if within a Property widget
    lookupPropertyTag();
    
    // Get the formtag from the page & register the widget
    FormTag formTag = TagHelper.getFormTag(pageContext);
    if(formTag == null) {
        String str = "The " + TAG_NAME + " should be inside a FormTag";
        log.error(str);
        throw new OuterFormTagMissingRuntimeException(str);
    }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:27,代码来源:FoldingSectionTag.java

示例7: handleSingleHeader

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Expose a single header value.
 * @throws JspException
 * @since Struts 1.2
 */
protected void handleSingleHeader() throws JspException {
    String value =
        ((HttpServletRequest) pageContext.getRequest()).getHeader(name);

    if ((value == null) && (this.value != null)) {
        value = this.value;
    }

    if (value == null) {
        JspException e =
            new JspException(messages.getMessage("header.get", name));
        TagUtils.getInstance().saveException(pageContext, e);
        throw e;
    }
    
    pageContext.setAttribute(id, value);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:HeaderTag.java

示例8: prepareName

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Prepare the name element
 * @return The element name.
 */
protected String prepareName() throws JspException {

    if (property == null) {
        return null;
    }

    // * @since Struts 1.1
    if(indexed) {
        StringBuffer results = new StringBuffer();
        prepareIndex(results, name);
        results.append(property);
        return results.toString();
    }

    return property;

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:RadioTag.java

示例9: doRedirect

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Redirect to the given path converting exceptions to JspException.
 * @param path The path to redirect to.
 * @throws JspException
 * @since Struts 1.2
 */
protected void doRedirect(String path) throws JspException {
    HttpServletRequest request =
        (HttpServletRequest) pageContext.getRequest();
        
    HttpServletResponse response =
        (HttpServletResponse) pageContext.getResponse();
        
    try {
        if (path.startsWith("/")) {
            path = request.getContextPath() + path;
        }
        
        response.sendRedirect(response.encodeRedirectURL(path));
        
    } catch (Exception e) {
        TagUtils.getInstance().saveException(pageContext, e);
        throw new JspException(
            messages.getMessage("forward.redirect", name, e.toString()));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:ForwardTag.java

示例10: doStartTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Overriding method of the heart of the tag. Gets the relative property
 * and tells the JSP engine to evaluate its body content.
 *
 * @return int JSP continuation directive.
 */
public int doStartTag() throws JspException {
  /* set the nested reference for possible inclusions etc */
  HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();

  // get al the originals
  originalName = name;
  originalNesting = NestedPropertyHelper.getCurrentProperty(request);
  originalNestingName = NestedPropertyHelper.getCurrentName(request, this);

  // set what we have to
  if (name != null) {
    NestedPropertyHelper.setProperty(request, "");
    NestedPropertyHelper.setName(request, this.name);
  }

  // do the JSP thing
  return (EVAL_BODY_TAG);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:NestedRootTag.java

示例11: doStartTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 *  Description of the Method
 *
 * @return
 * @exception  JspException
 */
public int doStartTag() throws JspException {
	try {
		setupTag( pageContext );
		MetadataVocabInputState inputState = (MetadataVocabInputState)pageContext.getSession().getAttribute( "MetadataVocabInputState" );
		if ( inputState == null ) {
			inputState = new MetadataVocabInputState();
		}
		if ( value != null ) {
			pageContext.getOut().print( vocab.getVocabCheckbox( group, value, label, inputState ) );
		}
		else {
			pageContext.getOut().print( vocab.getVocabCheckboxes( system, group, wrap, tdWidth, skipTopRow, inputState ) );
		}
	}
	catch ( java.io.IOException ex ) {
		throw new JspException( ex.getMessage() );
	}
	return SKIP_BODY;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:26,代码来源:MetadataVocabCheckboxesTag.java

示例12: processAsDefinitionOrURL

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Try to process name as a definition, or as an URL if not found.
 * @param name Name to process.
 * @return appropriate TagHandler
 * @throws JspException InstantiationException Can't create requested controller
 */
public TagHandler processAsDefinitionOrURL(String name)
	throws JspException {
	try {
		ComponentDefinition definition =
			TilesUtil.getDefinition(
				name,
				pageContext.getRequest(),
				pageContext.getServletContext());

		if (definition != null) {
			return processDefinition(definition);
		}

	} catch (DefinitionsFactoryException ex) {
		// silently failed, because we can choose to not define a factory.
	}

	// no definition found, try as url
	return processUrl(name);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:InsertTag.java

示例13: doEndTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * This is only overriden to clean up the include reference
 * @return int JSP continuation directive.
 */
public int doEndTag() throws JspException {
  // super result
  int temp = super.doEndTag();

  // all done. clean up
  HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
  // reset the original nesting values
  if (originalNesting == null) {
    NestedPropertyHelper.deleteReference(request);
  } else {
    NestedPropertyHelper.setProperty(request, originalNesting);
    NestedPropertyHelper.setName(request, originalNestingName);
  }

  // return the super result
  return temp;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:NestedFormTag.java

示例14: doEndTag

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
 * Render the end of this form.
 *
 * @exception JspException if a JSP exception has occurred
 */
public int doEndTag() throws JspException {

    // Remove the page scope attributes we created
    pageContext.removeAttribute(Constants.SELECT_KEY);

    // Render a tag representing the end of our current form
    StringBuffer results = new StringBuffer();
    if (saveBody != null) {
        results.append(saveBody);
        saveBody = null;
    }
    results.append("</select>");

    TagUtils.getInstance().write(pageContext, results.toString());

    return (EVAL_PAGE);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:SelectTag.java

示例15: getScope

import javax.servlet.jsp.JspException; //导入依赖的package包/类
/**
* Get scope value from string value
* @param scopeName Scope as a String.
* @param defaultValue Returned default value, if not found.
* @return Scope as an <code>int</code>, or <code>defaultValue</code> if scope is <code>null</code>.
* @throws JspException Scope name is not recognized as a valid scope.
*/
public static int getScope(String scopeName, int defaultValue) throws JspException {
    if (scopeName == null) {
        return defaultValue;
    }
    
    if (scopeName.equalsIgnoreCase("component")) {
        return ComponentConstants.COMPONENT_SCOPE;
        
    } else if (scopeName.equalsIgnoreCase("template")) {
        return ComponentConstants.COMPONENT_SCOPE;
        
    } else if (scopeName.equalsIgnoreCase("tile")) {
        return ComponentConstants.COMPONENT_SCOPE;
        
    } else {
        return org.apache.struts.taglib.TagUtils.getInstance().getScope(
            scopeName);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:TagUtils.java


注:本文中的javax.servlet.jsp.JspException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。