本文整理匯總了Java中javax.servlet.jsp.tagext.TagSupport.findAncestorWithClass方法的典型用法代碼示例。如果您正苦於以下問題:Java TagSupport.findAncestorWithClass方法的具體用法?Java TagSupport.findAncestorWithClass怎麽用?Java TagSupport.findAncestorWithClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.servlet.jsp.tagext.TagSupport
的用法示例。
在下文中一共展示了TagSupport.findAncestorWithClass方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doAfterBody
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
public int doAfterBody() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(baos, "UTF-8");
bodyContent.writeOut(writer);
writer.flush();
button.put("label", baos.toString("UTF-8"));
} catch (IOException e) {
e.printStackTrace();
}
DialogTag dialog = (DialogTag) TagSupport.findAncestorWithClass(this,
DialogTag.class);
dialog.addButton(button);
button = new HashMap<String, String>();
bodyContent.clearBody();
return SKIP_BODY;
}
示例2: doStartTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
@Override
public int doStartTag() throws JspException
{
_parentELContext = (ELContextTag)
TagSupport.findAncestorWithClass(this, ELContextTag.class);
// Transform "rendered" on behalf of the UIComponentTag
String rendered = _rendered;
if (rendered != null)
{
if ((_parentELContext != null) && isValueReference(rendered))
rendered = _parentELContext.transformExpression(rendered);
super.setRendered(rendered);
}
String id = _id;
if (id != null)
{
if (_parentELContext != null)
id = _parentELContext.transformId(id);
super.setId(id);
}
int retVal = super.doStartTag();
//pu: There could have been some validation error during property setting
// on the bean, this is the closest opportunity to burst out.
if (_validationError != null)
throw new JspException(_validationError);
return retVal;
}
示例3: doStartTagInternal
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
@Override
protected final int doStartTagInternal() throws JspException {
if (this.value != null) {
// Find the containing EditorAwareTag (e.g. BindTag), if applicable.
EditorAwareTag tag = (EditorAwareTag) TagSupport.findAncestorWithClass(this, EditorAwareTag.class);
if (tag == null) {
throw new JspException("TransformTag can only be used within EditorAwareTag (e.g. BindTag)");
}
// OK, let's obtain the editor...
String result = null;
PropertyEditor editor = tag.getEditor();
if (editor != null) {
// If an editor was found, edit the value.
editor.setValue(this.value);
result = editor.getAsText();
}
else {
// Else, just do a toString.
result = this.value.toString();
}
result = htmlEscape(result);
if (this.var != null) {
pageContext.setAttribute(this.var, result, TagUtils.getScope(this.scope));
}
else {
try {
// Else, just print it out.
pageContext.getOut().print(result);
}
catch (IOException ex) {
throw new JspException(ex);
}
}
}
return SKIP_BODY;
}
示例4: getParentEnumIteratorTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
/**
*
* @return
* @throws JspException
*/
protected EnumIteratorTag getParentEnumIteratorTag()
throws JspException
{
try
{
return (EnumIteratorTag)TagSupport.findAncestorWithClass(this, EnumIteratorTag.class);
}
catch (ClassCastException e)
{
throw new JspException("Parent tag of any derivation of AbstractEnumIteratorElementTag must be of type EnumIteratorTag");
}
}
示例5: getParentEnumIteratorTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
/**
*
* @return
* @throws JspException
*/
protected WellKnownOIDIteratorTag getParentEnumIteratorTag()
throws JspException
{
try
{
return (WellKnownOIDIteratorTag)TagSupport.findAncestorWithClass(this, WellKnownOIDIteratorTag.class);
}
catch (ClassCastException e)
{
throw new JspException("Parent tag of any derivation of AbstractEnumIteratorElementTag must be of type EnumIteratorTag");
}
}
示例6: getParentSeriesListTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
private AbstractSeriesCollectionTag getParentSeriesListTag()
throws JspException
{
try
{
return (AbstractSeriesCollectionTag)TagSupport.findAncestorWithClass(this, AbstractSeriesCollectionTag.class);
}
catch (ClassCastException e)
{
throw new JspException("SeriesCollectionElementTag must have an ancestor of type AbstractSeriesListTag");
}
}
示例7: getParentSeriesTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
private AbstractSeriesTag getParentSeriesTag()
throws JspException
{
try
{
return (AbstractSeriesTag)TagSupport.findAncestorWithClass(this, AbstractSeriesTag.class);
}
catch (ClassCastException e)
{
throw new JspException("Parent tag of AbstractSeriesPropertyTag must be of type AbstractSeriesTag");
}
}
示例8: getParentImageTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
private AbstractImageTag getParentImageTag()
throws JspException
{
try
{
return (AbstractImageTag)TagSupport.findAncestorWithClass(this, AbstractImageTag.class);
}
catch (ClassCastException e)
{
throw new JspException("Parent tag of AbstractImagePropertyTag must be of type AbstractImageTag");
}
}
示例9: doStartTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
@Override
public int doStartTag() throws JspException {
try {
if (this.bundle == null) {
I18nBundleTag bundleTag = (I18nBundleTag) TagSupport.findAncestorWithClass(this, I18nBundleTag.class);
if (bundleTag != null) {
this.bundle = bundleTag.getBundle();
}
}
if (this.bundle != null) this.value = this.bundle.getString(this.key);
/* this is a bad assumption, it won't necessarily be an ISO8859_1 charset, much better to just use the string as is
this.value = new String(s.getBytes("ISO8859_1"));
*/
} catch (Exception e) {
if (UtilJ2eeCompat.useNestedJspException(pageContext.getServletContext())) {
throw new JspException(e.getMessage(), e);
} else {
Debug.logError(e, "Server does not support nested exceptions, here is the exception", module);
throw new JspException(e.toString());
}
}
return EVAL_BODY_AGAIN;
}
示例10: getParentSeriesTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
private AbstractSeriesTag getParentSeriesTag()
throws JspException
{
try
{
return (AbstractSeriesTag)TagSupport.findAncestorWithClass(this, AbstractSeriesTag.class);
}
catch (ClassCastException e)
{
throw new JspException("SeriesImageCollectionTag must have an ancestor of type AbstractSeriesTag");
}
}
示例11: getParentListTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
private AbstractStudyListTag getParentListTag()
throws JspException
{
try
{
return (AbstractStudyListTag)TagSupport.findAncestorWithClass(this, AbstractStudyListTag.class);
}
catch (ClassCastException e)
{
throw new JspException("StudyListElementTag must have an ancestor of type AbstractStudyListTag");
}
}
示例12: doEndTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
/**
*
* @see PortletTag
*/
public int doEndTag() throws JspException {
// Ensure that the portlet render tag resides within a portlet tag.
PortletTag parentTag = (PortletTag) TagSupport.findAncestorWithClass(this, PortletTag.class);
if (parentTag == null) {
throw new JspException("Portlet render tag may only reside " + "within a pluto:portlet tag.");
}
// If the portlet is rendered successfully, print the rendering result.
try {
if (parentTag.getStatus() == PortletTag.SUCCESS) {
StringBuffer buffer = parentTag.getPortalServletResponse().getInternalBuffer().getBuffer();
pageContext.getOut().print(buffer.toString());
} else {
// Otherwise, print the error messages
List<String> msgs = parentTag.getMessages();
if (msgs.isEmpty()) {
pageContext.getOut().print(" Unknown error rendering portlet.");
} else {
for (String msg : msgs) {
pageContext.getOut().print("<p>");
pageContext.getOut().print(msg);
pageContext.getOut().print("</p>");
}
}
}
} catch (IOException ex) {
throw new JspException(ex);
}
// Return.
return SKIP_BODY;
}
示例13: doEndTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
/**
* ${@inheritDoc}
*/
public int doEndTag() throws JspException {
ListCommand cmd = ListTagUtil.getCurrentCommand(this, pageContext);
ListTag parent = (ListTag) TagSupport.findAncestorWithClass(this, ListTag.class);
if (cmd.equals(ListCommand.TBL_ADDONS) && role.equals("header")) {
renderHeader(parent);
}
else if (cmd.equals(ListCommand.BEFORE_RENDER) && role.equals("footer")) {
renderFooter(parent);
}
return TagSupport.EVAL_PAGE;
}
示例14: doEndTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
/**
* When reach the end tag, fire this operation
*
* @see javax.servlet.jsp.tagext.BodyTagSupport#doEndTag()
*/
public int doEndTag( ) throws JspException
{
if ( param.validate( ) )
{
// included in viewer tag
AbstractViewerTag viewerTag = (AbstractViewerTag) TagSupport
.findAncestorWithClass( this, AbstractViewerTag.class );
if ( viewerTag != null )
viewerTag.addParameter( param );
}
return super.doEndTag( );
}
示例15: doEndTag
import javax.servlet.jsp.tagext.TagSupport; //導入方法依賴的package包/類
/**
* When reach the end tag, fire this operation
*
* @see javax.servlet.jsp.tagext.BodyTagSupport#doEndTag()
*/
public int doEndTag( ) throws JspException
{
try
{
if ( __validate( ) )
{
// included in parameterpage tag
this.requesterTag = (RequesterTag) TagSupport
.findAncestorWithClass( this, RequesterTag.class );
if ( requesterTag != null )
{
this.viewer = requesterTag.viewer;
if ( this.viewer.isCustom( ) )
{
__beforeEndTag( );
__process( );
}
}
}
}
catch ( Exception e )
{
__handleException( e );
}
return super.doEndTag( );
}