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;
}
java类javax.servlet.jsp.JspTagException的实例源码
UrlTag.java 文件源码
项目:airsonic
阅读 35
收藏 0
点赞 0
评论 0
ForEachTag.java 文件源码
项目:myfaces-trinidad
阅读 34
收藏 0
点赞 0
评论 0
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");
}
}
SectionTitle.java 文件源码
项目:unitimes
阅读 38
收藏 0
点赞 0
评论 0
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'> </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;
}
Confirm.java 文件源码
项目:unitimes
阅读 36
收藏 0
点赞 0
评论 0
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;
}
SampleTag.java 文件源码
项目:parabuild-ci
阅读 39
收藏 0
点赞 0
评论 0
/**
* 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;
}
ValuesTag.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 36
收藏 0
点赞 0
评论 0
@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();
}
ValuesTag.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 43
收藏 0
点赞 0
评论 0
@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();
}
MenuTag.java 文件源码
项目:melon
阅读 34
收藏 0
点赞 0
评论 0
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;
}
OscarDemographicLinkTag.java 文件源码
项目:OSCAR-ConCert
阅读 31
收藏 0
点赞 0
评论 0
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;
}
OscarTag.java 文件源码
项目:OSCAR-ConCert
阅读 30
收藏 0
点赞 0
评论 0
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;
}
UrlTag.java 文件源码
项目:subsonic
阅读 35
收藏 0
点赞 0
评论 0
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;
}
FmtMessageTag.java 文件源码
项目:communote-server
阅读 33
收藏 0
点赞 0
评论 0
/**
* {@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;
}
StringAbbreviator.java 文件源码
项目:easyrec_major
阅读 38
收藏 0
点赞 0
评论 0
public int doEndTag() throws javax.servlet.jsp.JspTagException {
try {
if (myString.length() > maxLength) {
CharSequence substr;
if (reversed)
substr = "…" + myString.subSequence(Math.max(myString.length() - maxLength, 0),
myString.length());
else
substr = myString.subSequence(0, maxLength) + "…";
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;
}
ProfileRenderer.java 文件源码
项目:easyrec_major
阅读 35
收藏 0
点赞 0
评论 0
@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;
}
AbsoluteUrl.java 文件源码
项目:easyrec_major
阅读 34
收藏 0
点赞 0
评论 0
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;
}
GetStoreNameTag.java 文件源码
项目:g2
阅读 38
收藏 0
点赞 0
评论 0
@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;
}
UrlRewriteTag.java 文件源码
项目:metaworks_framework
阅读 34
收藏 0
点赞 0
评论 0
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;
}
UrlRewriteTag.java 文件源码
项目:SparkCommerce
阅读 36
收藏 0
点赞 0
评论 0
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;
}
CacheTag.java 文件源码
项目:gomall.la
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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;
}
OpenmrsMessageTag.java 文件源码
项目:openmrs-module-legacyui
阅读 38
收藏 0
点赞 0
评论 0
/**
* @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));
}
}
ModifyUserHistoryTag.java 文件源码
项目:ontopia
阅读 40
收藏 0
点赞 0
评论 0
/**
* 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;
}
AssociationTypeLoopTag.java 文件源码
项目:ontopia
阅读 39
收藏 0
点赞 0
评论 0
/**
* 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;
}
}
AttributeTag.java 文件源码
项目:ontopia
阅读 35
收藏 0
点赞 0
评论 0
/**
* 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;
}
ColumnContentTag.java 文件源码
项目:irplus
阅读 34
收藏 0
点赞 0
评论 0
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);
}
}
}
BasicButtonInputTag.java 文件源码
项目:irplus
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
RelatedTag.java 文件源码
项目:ontopia
阅读 33
收藏 0
点赞 0
评论 0
@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;
}
BasicImageInputTag.java 文件源码
项目:irplus
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
IndicatorsTag.java 文件源码
项目:ontopia
阅读 34
收藏 0
点赞 0
评论 0
@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;
}
SectionTitle.java 文件源码
项目:unitime
阅读 34
收藏 0
点赞 0
评论 0
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'> </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;
}
BaseOutputProducingTag.java 文件源码
项目:ontopia
阅读 42
收藏 0
点赞 0
评论 0
/**
* 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;
}