Java 类javax.servlet.jsp.JspTagException 实例源码

项目:airsonic    文件:UrlTag.java   
public int doEndTag() throws JspException {

        // Rewrite and encode the url.
        String result = formatUrl();

        // Store or print the output
        if (var != null)
            pageContext.setAttribute(var, result, PageContext.PAGE_SCOPE);
        else {
            try {
                pageContext.getOut().print(result);
            } catch (IOException x) {
                throw new JspTagException(x);
            }
        }
        return EVAL_PAGE;
    }
项目:myfaces-trinidad    文件:ForEachTag.java   
private void _validateAttributes(
  ) throws JspTagException
{
  // Ensure that the begin and and have been specified if the items attribute was not
  if (null == _items)
  {
    if (null == _begin || null == _end)
    {
      throw new JspTagException(
        "'begin' and 'end' should be specified if 'items' is not specified");
    }
  }

  // Ensure the user has not set the var and varStatus attributes to the save value
  if ((_var != null) && _var.equals(_varStatus))
  {
    throw new JspTagException(
      "'var' and 'varStatus' should not have the same value");
  }
}
项目:unitimes    文件:SectionTitle.java   
public int doEndTag() throws JspException {
    if (getParent()!=null && getParent() instanceof SectionHeader) {
        ((SectionHeader)getParent()).setTitle(getBodyContent().getString());
    } else {
        try {
            String body = (getBodyContent()==null?null:getBodyContent().getString());
            if (body==null || body.trim().length()==0) {
                pageContext.getOut().println("<DIV class='WelcomeRowHeadBlank'>&nbsp;</DIV>");
            } else {
                pageContext.getOut().println("<DIV class='WelcomeRowHead'>");
                pageContext.getOut().println(body);
                pageContext.getOut().println("</DIV>");
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new JspTagException(e.getMessage());
        }
    }
    return EVAL_PAGE;
}
项目:unitimes    文件:Confirm.java   
public int doEndTag() throws JspException {
    try {
        String body = (getBodyContent()==null?null:getBodyContent().getString());
        if (body==null || body.trim().length()==0) body = "Are you sure?";
        pageContext.getOut().println("<SCRIPT language='javascript'>");
        pageContext.getOut().println("<!--");
        pageContext.getOut().println("function "+getName()+"() {");
        if (JavascriptFunctions.isJsConfirm(getSessionContext())) {
            pageContext.getOut().println("return confirm(\""+body+"\");");
        } else {
            pageContext.getOut().println("return true;");
        }
        pageContext.getOut().println("}");
        pageContext.getOut().println("// -->");
        pageContext.getOut().println("</SCRIPT>");
    } catch (Exception e) {
        e.printStackTrace();
        throw new JspTagException(e.getMessage());
    }
    return EVAL_PAGE;
}
项目:parabuild-ci    文件:SampleTag.java   
/**
 * Does two things:
 * <ul>
 *      <li>Stops the page if the corresponding attribute has been set</li>
 *      <li>Prints a message another tag encloses this one.</li>
 * </ul>
 */
public int doEndTag() throws JspTagException
{
    //get the parent if any
    Tag parent = this.getParent();

    if (parent != null) {
        try {
            JspWriter out = this.pageContext.getOut();
            out.println("This tag has a parent. <BR>");

        } catch (IOException e) {
            throw new JspTagException(e.getMessage());
        }
    }

    if (this.stopPage) {

        return Tag.SKIP_PAGE;
    }

    return Tag.EVAL_PAGE;
}
项目:apache-tomcat-7.0.73-with-comment    文件:ValuesTag.java   
@Override
public int doEndTag() throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        if (!"-1".equals(objectValue)) {
            out.print(objectValue);
        } else if (!"-1".equals(stringValue)) {
            out.print(stringValue);
        } else if (longValue != -1) {
            out.print(longValue);
        } else if (doubleValue != -1) {
            out.print(doubleValue);
        } else {
            out.print("-1");
        }
    } catch (IOException ex) {
        throw new JspTagException("IOException: " + ex.toString(), ex);
    }
    return super.doEndTag();
}
项目:apache-tomcat-7.0.73-with-comment    文件:ValuesTag.java   
@Override
public int doEndTag() throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        if (!"-1".equals(objectValue)) {
            out.print(objectValue);
        } else if (!"-1".equals(stringValue)) {
            out.print(stringValue);
        } else if (longValue != -1) {
            out.print(longValue);
        } else if (doubleValue != -1) {
            out.print(doubleValue);
        } else {
            out.print("-1");
        }
    } catch (IOException ex) {
        throw new JspTagException("IOException: " + ex.toString(), ex);
    }
    return super.doEndTag();
}
项目:melon    文件:MenuTag.java   
public int doEndTag() throws JspTagException {
    try {
        JspWriter out = this.pageContext.getOut();
        String menu = (String) this.pageContext.getSession().getAttribute("menu");
        if (menu != null) {
            out.print(menu);
        } else {
            menu = end().toString();
            out.print(menu);
        }

    } catch (IOException e) {
        e.printStackTrace();
    }
    return EVAL_PAGE;
}
项目:OSCAR-ConCert    文件:OscarDemographicLinkTag.java   
public int doStartTag() throws JspException {
    try {
        HttpSession se = ((HttpServletRequest) pc.getRequest()).getSession();
        String p = (String) se.getAttribute("OscarPageURL");

        if (p == null || p.equals("")) {
            pc.getOut().print("");
        } else {
            p = p.substring(0, p.indexOf("/provider"));
            p += "/demographic/demographiccontrol.jsp?displaymode=edit&dboperation=search_detail&demographic_no=" + demographicNo;
            String temps = "<a href=\"javascript.void(0);\" onclick=\"window.open('" + p + "','demographic');return false;\">OSCAR Master File</a>";
            pc.getOut().print(temps);
        }

    } catch (Exception e) {
        throw new JspTagException("An IOException occurred.");
    }

    return SKIP_BODY;
}
项目:OSCAR-ConCert    文件:OscarTag.java   
public int doStartTag() throws JspException {
    try {
        HttpSession se = ((HttpServletRequest) pc.getRequest()).getSession();
        String p = (String) se.getAttribute("OscarPageURL");
        String q = (String) se.getAttribute("OscarPageQuery");

        if (p == null) {
            pc.getOut().print("");
        } else if (p.equals("")) {
            pc.getOut().print("");
        } else {
            p = p.substring(0, p.lastIndexOf("/") + 1) + "providercontrol.jsp?" + q;
            String temps = "<a href='" + p + "'>Oscar Medical</a>";
            pc.getOut().print(temps);
        }

    } catch (Exception e) {
        throw new JspTagException("An IOException occurred.");
    }

    return SKIP_BODY;
}
项目:subsonic    文件:UrlTag.java   
public int doEndTag() throws JspException {

        // Rewrite and encode the url.
        String result = formatUrl();

        // Store or print the output
        if (var != null)
            pageContext.setAttribute(var, result, PageContext.PAGE_SCOPE);
        else {
            try {
                pageContext.getOut().print(result);
            } catch (IOException x) {
                throw new JspTagException(x);
            }
        }
        return EVAL_PAGE;
    }
项目:communote-server    文件:FmtMessageTag.java   
/**
 * {@inheritDoc}
 */
@Override
public int doEndTag() throws JspException {
    String key = null;
    if (keySpecified) {
        key = keyAttrValue;
    } else if (bodyContent != null && bodyContent.getString() != null) {
        key = bodyContent.getString().trim();
    }

    String message = ResourceBundleManager.instance().getText(key, getLocale(),
            params.toArray());
    if (var != null) {
        pageContext.setAttribute(var, message, scope);
    } else {
        try {
            pageContext.getOut().print(message);
        } catch (IOException ioe) {
            throw new JspTagException(ioe.toString(), ioe);
        }
    }

    return EVAL_PAGE;
}
项目:easyrec_major    文件:StringAbbreviator.java   
public int doEndTag() throws javax.servlet.jsp.JspTagException {
    try {
        if (myString.length() > maxLength) {
            CharSequence substr;

            if (reversed)
                substr = "&hellip;" + myString.subSequence(Math.max(myString.length() - maxLength, 0),
                        myString.length());
            else
                substr = myString.subSequence(0, maxLength) + "&hellip;";

            pageContext.getOut().write("<span title='" + myString + "'>" + substr + "</span>");
        } else {
            pageContext.getOut().write(myString);
        }
    } catch (java.io.IOException e) {
        throw new JspTagException("IO Error: " + e.getMessage());
    }
    return EVAL_PAGE;
}
项目:easyrec_major    文件:ProfileRenderer.java   
@Override
public int doEndTag() throws JspTagException {
    try {
        String tagId = "profile" + Long.toString(System.currentTimeMillis());
        StringBuilder fullHTML = new StringBuilder();
        fullHTML.append("<div class=\"profile\">");
        String profileContent = getSourceViewJSON(profile); //since JSON is now the primary format, we try this first
        if (profileContent == null) {
            profileContent = getListViewHTML(profile); 
        }
        if (profileContent == null) {
            profileContent = getSourceViewHTML(profile); 
        }
        fullHTML.append("   <div id=\"profileHTML-").append(tagId).append("\">");
        fullHTML.append(profileContent);
        fullHTML.append("   </div>");
        fullHTML.append("</div>");

        pageContext.getOut().write(fullHTML.toString());
    } catch (java.io.IOException e) {
        throw new JspTagException("IO Error: " + e.getMessage());
    }
    return EVAL_PAGE;
}
项目:easyrec_major    文件:AbsoluteUrl.java   
public int doEndTag() throws JspException {

        if (this.remoteTenantDAO == null) {
            ServletContext servletContext = this.pageContext.getServletContext();
            ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
            this.remoteTenantDAO= (RemoteTenantDAO) context.getBean("remoteTenantDAO");
        }

        try {
            RemoteTenant rt = this.remoteTenantDAO.get(operatorId, tenantId);
            String stringRep = Text.matchMax(rt.getUrl(), itemUrl);
            String result = encodeForHTMLAttribute(stringRep);
            this.pageContext.getOut().write(result);
        } catch (java.io.IOException e) {
            throw new JspTagException("IO Error: " + e.getMessage());
        }
        return EVAL_PAGE;
    }
项目:g2    文件:GetStoreNameTag.java   
@Override
public int doEndTag() throws JspTagException {
    try {
        WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext());//获取SPRING的上下文
        StoreService storeService = (StoreService) ctx.getBean("storeService");
        Stores stores =  storeService.findById(Long.parseLong(id));
        if(stores!=null){
            pageContext.getOut().write(stores.getName());
        }else if(id.equals("0")){
            pageContext.getOut().write("<b>超级管理员</b>");
        }else{
            pageContext.getOut().write("<b>项目已不存在</b>");

        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return EVAL_PAGE;
}
项目:metaworks_framework    文件:UrlRewriteTag.java   
public int doStartTag() throws JspException {
    initServices();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String returnValue = staticAssetService.convertAssetPath(value, request.getContextPath(), isRequestSecure());

    if (var != null) {
        pageContext.setAttribute(var, returnValue);
    } else {
        try {
            pageContext.getOut().print(returnValue);
        } catch (IOException ioe) {
            throw new JspTagException(ioe.toString(), ioe);
        }
    }

    return EVAL_PAGE;
}
项目:SparkCommerce    文件:UrlRewriteTag.java   
public int doStartTag() throws JspException {
    initServices();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String returnValue = staticAssetService.convertAssetPath(value, request.getContextPath(), isRequestSecure());

    if (var != null) {
        pageContext.setAttribute(var, returnValue);
    } else {
        try {
            pageContext.getOut().print(returnValue);
        } catch (IOException ioe) {
            throw new JspTagException(ioe.toString(), ioe);
        }
    }

    return EVAL_PAGE;
}
项目:gomall.la    文件:CacheTag.java   
/**
 * After the cache body, either update the cache, serve new cached content
 * or indicate an error.
 * 
 * @return The standard BodyTag return.
 * @throws JspTagException
 *             The standard exception thrown.
 */
@Override
public int doAfterBody() throws JspTagException {
    String body = null;
    try {
        // if we have a body, and we have not been told to use the cached
        // version
        if ((bodyContent != null) && ((body = bodyContent.getString()) != null)) {
            Cache cache = legendCacheManager.getCache(cacheName);
            cache.put(generateKey(), body);
            bodyContent.clearBody();
            bodyContent.write(body);
            bodyContent.writeOut(bodyContent.getEnclosingWriter());
        }
    } catch (java.io.IOException e) {
        throw new JspTagException("IO Error: " + e.getMessage());
    }

    return SKIP_BODY;
}
项目:openmrs-module-legacyui    文件:OpenmrsMessageTag.java   
/**
 * @see MessageTag#doStartTagInternal()
 * @should evaluate specified message resolvable
 * @should resolve message by code
 * @should resolve message in locale that different from default
 * @should return code if no message resolved
 * @should use body content as fallback if no message resolved
 * @should use text attribute as fallback if no message resolved
 * @should use body content in prior to text attribute as fallback if no message resolved
 * @should ignore fallbacks if tag locale differs from context locale
 */
@Override
protected int doEndTagInternal() throws JspException, IOException {
    try {
        // Resolve the unescaped message.
        String msg = resolveMessage();

        // HTML and/or JavaScript escape, if demanded.
        msg = isHtmlEscape() ? HtmlUtils.htmlEscape(msg) : msg;
        msg = this.javaScriptEscape ? JavaScriptUtils.javaScriptEscape(msg) : msg;

        // Expose as variable, if demanded, else write to the page.
        String resolvedVar = this.var;
        if (resolvedVar != null) {
            pageContext.setAttribute(resolvedVar, msg, TagUtils.getScope(this.scope));
        } else {
            writeMessage(msg);
        }

        return EVAL_PAGE;
    }
    catch (NoSuchMessageException ex) {
        throw new JspTagException(getNoSuchMessageExceptionDescription(ex));
    }
}
项目:ontopia    文件:ModifyUserHistoryTag.java   
/**
 * Process the start tag for this instance.
 */
@Override
public int doStartTag() throws JspTagException {
  // only do anything if valid user object exists
  UserIF user = FrameworkUtils.getUser(pageContext);
  HistoryMap history = user.getHistory();
  if (history != null) {
    Object obj = pageContext.findAttribute(objectName);
    // log.debug("Found object " + obj );
    if (obj != null) {
      if (opName.equals(OP_ADD))
        history.add(obj);
      else
        history.removeEntry(obj);
    } else
      log.info("Could not find object by name '" + objectName + "'.");
  } else
    log.info("No history attached to user object");
  // empty tag has not to eval anything
  return SKIP_BODY;
}
项目:ontopia    文件:AssociationTypeLoopTag.java   
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  // put out the evaluated body
  BodyContent body = getBodyContent();
  JspWriter out = null;
  try {
    out = body.getEnclosingWriter();
    out.print(body.getString());
    body.clearBody();
  } catch(IOException ioe) {
    throw new NavigatorRuntimeException("Error in AssociationTypeLoopTag.", ioe);
  }

  // test if we have to repeat the body 
  if (index < assocStore.length) {
    // set to next value in list
    setVariableValues(assocStore[index]);
    index++;
    return EVAL_BODY_AGAIN;
  } else {
    return SKIP_BODY;
  }

}
项目:ontopia    文件:AttributeTag.java   
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  ElementTag elementTag = (ElementTag)
    findAncestorWithClass(this, ElementTag.class);

  if (elementTag != null) {
    // get body content
    BodyContent body = getBodyContent();
    if (body != null) {
      String content = body.getString();
      // add this attribute to parent element tag 
      elementTag.addAttribute(attrName, content);
      body.clearBody();
    } else {
      log.warn("AttributeTag: body content is null!");
    }
  } else {
    log.warn("AttributeTag: no parent element tag found!");
  }

  // only evaluate body once
  return SKIP_BODY;
}
项目:irplus    文件:ColumnContentTag.java   
public void doTag() throws JspException {

        TableRowTag rowTag = (TableRowTag) findAncestorWithClass(this,
                TableRowTag.class);

        ColumnTag columnTag = (ColumnTag)findAncestorWithClass(this,
                ColumnTag.class);

        if (columnTag == null) {
            throw new JspTagException("the <ur:columnContent> tag must"
                    + " be nested within a <ur:column> tag");
        }

        if (rowTag.isProcessColumn()) 
        {
            JspFragment body = getJspBody();
            try {
                body.invoke(null);
            } catch (IOException e) {
                e.printStackTrace();
                throw new JspException("Error in columnContent", e);
            }
        }
}
项目:irplus    文件:BasicButtonInputTag.java   
/**
 * Create the checkbox tag.
 * 
 * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag()
 */
public void doTag() throws JspException {

    BasicFormTag formTag = (BasicFormTag) findAncestorWithClass(this,
            BasicFormTag.class);

    if (formTag == null) {
        throw new JspTagException("the <ur:button> tag must"
                + " be nested within a <ur:form> tag");
    }

       PageContext pageContext = (PageContext) getJspContext();
    JspWriter out = pageContext.getOut();

    try {
        out.print("\n<input ");
        out.print(getAttributes());
        out.print("/>");
  } catch (Exception e) {
           throw new JspException(e);
  }
}
项目:ontopia    文件:RelatedTag.java   
@Override
public int doStartTag() throws JspTagException {
  ContextTag contextTag = FrameworkUtils.getContextTag(pageContext);
  if (related == null)
    buildModel(contextTag);

  TopicIF topic = (TopicIF) getVariableValue(this.topic);
  if (topic == null)
    throw new JspTagException("Couldn't find topic '" + topic + "'");
  List headings = related.makeModel(topic);
  pageContext.setAttribute(var, headings, PageContext.REQUEST_SCOPE);

  // FIXME: make new scope here
  if (contextTag != null)
    contextTag.getContextManager().setValue(var, headings);

  return EVAL_BODY_INCLUDE;
}
项目:irplus    文件:BasicImageInputTag.java   
/**
 * Create the image tag.
 * 
 * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag()
 */
public void doTag() throws JspException {

    BasicFormTag formTag = (BasicFormTag) findAncestorWithClass(this,
            BasicFormTag.class);

    if (formTag == null) {
        throw new JspTagException("the <ur:image> tag must"
                + " be nested within a <ur:form> tag");
    }

       context = (PageContext) getJspContext();
    JspWriter out = context.getOut();

    try {
        out.print("\n<input ");
        out.print(getAttributes());
        out.print("/>");
  } catch (Exception e) {
           throw new JspException(e);
  }
}
项目:ontopia    文件:IndicatorsTag.java   
@Override
public Collection process(Collection topics) throws JspTagException {
  // find all subject indicators of all topics in collection
  List subjectIndicators = new ArrayList();
  if (topics != null) {
    Iterator iter = topics.iterator();

    while (iter.hasNext()) {
      TopicIF topic = null;

      try {
        topic = (TopicIF) iter.next();
      } catch (ClassCastException e) {
        continue; // non-topic objects have no indicators
      }

      // get all subject indicators for specified topic as LocatorIF objects
      if (topic != null)
        subjectIndicators.addAll( topic.getSubjectIdentifiers() );
    }
  }
  return subjectIndicators;
}
项目:unitime    文件:SectionTitle.java   
public int doEndTag() throws JspException {
    if (getParent()!=null && getParent() instanceof SectionHeader) {
        ((SectionHeader)getParent()).setTitle(getBodyContent().getString());
    } else {
        try {
            String body = (getBodyContent()==null?null:getBodyContent().getString());
            if (body==null || body.trim().length()==0) {
                pageContext.getOut().println("<DIV class='WelcomeRowHeadBlank'>&nbsp;</DIV>");
            } else {
                pageContext.getOut().println("<DIV class='WelcomeRowHead'>");
                pageContext.getOut().println(body);
                pageContext.getOut().println("</DIV>");
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new JspTagException(e.getMessage());
        }
    }
    return EVAL_PAGE;
}
项目:ontopia    文件:BaseOutputProducingTag.java   
/**
 * Process the start tag for this instance.
 */
@Override
public int doStartTag() throws JspTagException {
  try {
    Object outObject = generateOutputObject();

    JspWriter out = pageContext.getOut();
    generateOutput(out, outObject);
  } catch (IOException ioe) {
    String msg = "Error in " + getName() + ": " + ioe.getMessage();
    log.error(msg);
    throw new NavigatorRuntimeException(msg, ioe);
  }

  return SKIP_BODY;
}
项目:ontopia    文件:SourceLocatorsTag.java   
@Override
public Collection process(Collection tmObjs) throws JspTagException {
  // find all source locators of all topic map objects in collection
  if (tmObjs == null || tmObjs.isEmpty())
    return Collections.EMPTY_SET;
  else {
    List sourceLocators = new ArrayList();
    Iterator iter = tmObjs.iterator();

    while (iter.hasNext()) {
      try {
        TMObjectIF tmObj = (TMObjectIF) iter.next();
        // get all source locators as LocatorIF objects
        if (tmObj != null)
          sourceLocators.addAll( tmObj.getItemIdentifiers() );
      } catch (ClassCastException e) {
      }
    }
    return sourceLocators;
  }
}
项目:WebRex    文件:ResourceTagHandler.java   
protected void handleBody() throws JspTagException {
   if (bodyContent != null) {
      String content = bodyContent.getString();

      if (content != null) {
         m_tag.getModel().setContent(content);
      }
   }

   IResource resource = buildComponent();
   if (resource != null) {
      renderComponent(resource);
   }

   flushBuffer();
}
项目:ontopia    文件:ForEachTag.java   
/**
 * Process the end tag.
 */
@Override
public int doEndTag() throws JspException {
  if (!(queryWrapper.fullyGrouped() || neverEvaluatedBody))
    throw new JspTagException("<tolog:foreach> - tag insufficiently grouped"
            + " or missing grouping descendant."
              + "\nA grouping descendant is another <tolog:foreach> tag"
              + " that is nested within this <tolog:foreach> tag and"
              + " groups its result further."
              + "\nA <tolog:foreach> tag is insufficiently grouped if it"
              + " has no grouping descendant and uses the \"groupBy\""
              + " attribute to group by some but not all its columns.\n");

  // establish old lexical scope, back to outside of the loop
  queryWrapper.getContextManager().popScope();
  reset();
  return super.doEndTag();
}
项目:ontopia    文件:ReifierTag.java   
@Override
public Collection process(Collection tmObjects) throws JspTagException {
  // Find all reifying topics of all topic map objects in collection
  if (tmObjects == null || tmObjects.isEmpty())
    return Collections.EMPTY_SET;
  else {
    ArrayList reifyingTopics = new ArrayList();
    Iterator iter = tmObjects.iterator();
    TopicIF reifyingTopic;
    // Loop over the topic map objects
    while (iter.hasNext()) {
      // Get the topic that reifies the given topic map object
      reifyingTopic = ((ReifiableIF)iter.next()).getReifier();
      // If a topic was found add it to the result list.
      if (reifyingTopic != null)
        reifyingTopics.add(reifyingTopic);    
    }
    // Return all reifiying topics found.
    return reifyingTopics;
  }
}
项目:tomcat7    文件:Util.java   
/** Utility methods
 * taken from org.apache.taglibs.standard.tag.common.core.UrlSupport
 */
public static String resolveUrl(
        String url, String context, PageContext pageContext)
throws JspException {
    // don't touch absolute URLs
    if (isAbsoluteUrl(url))
        return url;

    // normalize relative URLs against a context root
    HttpServletRequest request =
        (HttpServletRequest) pageContext.getRequest();
    if (context == null) {
        if (url.startsWith("/"))
            return (request.getContextPath() + url);
        else
            return url;
    } else {
        if (!context.startsWith("/") || !url.startsWith("/")) {
            throw new JspTagException(
            "In URL tags, when the \"context\" attribute is specified, values of both \"context\" and \"url\" must start with \"/\".");
        }
        if (context.equals("/")) {
            // Don't produce string starting with '//', many
            // browsers interpret this as host name, not as
            // path on same host.
            return url;
        } else {
            return (context + url);
        }
    }
}
项目:airsonic    文件:ParamTag.java   
public int doEndTag() throws JspTagException {

        // Add parameter name and value to surrounding 'url' tag.
        UrlTag tag = (UrlTag) findAncestorWithClass(this, UrlTag.class);
        if (tag == null) {
            throw new JspTagException("'sub:param' tag used outside 'sub:url'");
        }
        tag.addParameter(name, value);
        return EVAL_PAGE;
    }
项目:airsonic    文件:WikiTag.java   
public int doEndTag() throws JspException {
    String result;
    synchronized (RENDER_ENGINE) {
        result = RENDER_ENGINE.render(StringEscapeUtils.unescapeXml(text), RENDER_CONTEXT);
    }
    try {
        pageContext.getOut().print(result);
    } catch (IOException x) {
        throw new JspTagException(x);
    }
    return EVAL_PAGE;
}
项目:airsonic    文件:UrlTag.java   
private String formatUrl() throws JspException {
    String baseUrl = UrlSupport.resolveUrl(value, null, pageContext);

    StringBuffer result = new StringBuffer();
    result.append(baseUrl);
    if (!parameters.isEmpty()) {
        result.append('?');

        for (int i = 0; i < parameters.size(); i++) {
            Parameter parameter = parameters.get(i);
            try {
                result.append(parameter.getName());
                if (isUtf8Hex() && !isAsciiAlphaNumeric(parameter.getValue())) {
                    result.append(ParameterDecodingFilter.PARAM_SUFFIX);
                }

                result.append('=');
                if (parameter.getValue() != null) {
                    result.append(encode(parameter.getValue()));
                }
                if (i < parameters.size() - 1) {
                    result.append("&");
                }

            } catch (UnsupportedEncodingException x) {
                throw new JspTagException(x);
            }
        }
    }
    return result.toString();
}
项目:airsonic    文件:EscapeJavaScriptTag.java   
public int doEndTag() throws JspException {
    try {
        pageContext.getOut().print(StringEscapeUtils.escapeJavaScript(string));
    } catch (IOException x) {
        throw new JspTagException(x);
    }
    return EVAL_PAGE;
}
项目:airsonic    文件:FormatBytesTag.java   
public int doEndTag() throws JspException {
    Locale locale = RequestContextUtils.getLocale((HttpServletRequest) pageContext.getRequest());
    String result = StringUtil.formatBytes(bytes, locale);

    try {
        pageContext.getOut().print(result);
    } catch (IOException x) {
        throw new JspTagException(x);
    }
    return EVAL_PAGE;
}