/**
* 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));
}
java类javax.servlet.jsp.JspException的实例源码
HeaderTag.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
DefinitionTag.java 文件源码
项目:lams
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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);
}
NestedWriteNestingTag.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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);
}
EditorTag.java 文件源码
项目:lams
阅读 25
收藏 0
点赞 0
评论 0
@Override
public int doStartTag() throws JspException {
try {
fckEditor = new FCKeditor((HttpServletRequest) pageContext
.getRequest(), instanceName, inputName);
if (Utils.isNotEmpty(width))
fckEditor.setWidth(width);
if (Utils.isNotEmpty(height))
fckEditor.setHeight(height);
if (Utils.isNotEmpty(toolbarSet))
fckEditor.setToolbarSet(toolbarSet);
if (Utils.isNotEmpty(value))
fckEditor.setValue(value);
if (Utils.isNotEmpty(basePath))
fckEditor.setBasePath(basePath);
} catch (Exception e) {
throw new JspException(e);
}
return EVAL_BODY_INCLUDE;
}
WriteTag.java 文件源码
项目:lams
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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;
}
}
NestedFormTag.java 文件源码
项目:lams
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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;
}
FoldingSectionTag.java 文件源码
项目:jaffa-framework
阅读 32
收藏 0
点赞 0
评论 0
/** 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);
}
}
HeaderTag.java 文件源码
项目:lams
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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);
}
RadioTag.java 文件源码
项目:lams
阅读 32
收藏 0
点赞 0
评论 0
/**
* 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;
}
ForwardTag.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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()));
}
}
NestedRootTag.java 文件源码
项目:lams
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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);
}
MetadataVocabCheckboxesTag.java 文件源码
项目:joai-project
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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;
}
InsertTag.java 文件源码
项目:lams
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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);
}
NestedFormTag.java 文件源码
项目:lams
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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;
}
SelectTag.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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);
}
TagUtils.java 文件源码
项目:lams
阅读 37
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
GridTag.java 文件源码
项目:jaffa-framework
阅读 26
收藏 0
点赞 0
评论 0
/** Returns a true if all the rows of the GridModel have not been iterated through.
* @return a true if all the rows of the GridModel have not been iterated through.
*/
public boolean theBodyShouldBeEvaluatedAgain() throws JspException {
if (m_modelIterator != null && m_modelIterator.hasNext() ) {
m_currentRow = (GridModelRow) m_modelIterator.next();
setRowContext();
return true;
} else {
return false;
}
}
UseAttributeTag.java 文件源码
项目:lams
阅读 30
收藏 0
点赞 0
评论 0
/**
* Expose the requested attribute from component context.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException
{
// Do a local copy of id
String localId=this.id;
if( localId==null )
localId=attributeName;
ComponentContext compContext = (ComponentContext)pageContext.getAttribute( ComponentConstants.COMPONENT_CONTEXT, PageContext.REQUEST_SCOPE);
if( compContext == null )
throw new JspException ( "Error - tag useAttribute : no tiles context found." );
Object value = compContext.getAttribute(attributeName);
// Check if value exists and if we must send a runtime exception
if( value == null )
if(!isErrorIgnored)
throw new JspException ( "Error - tag useAttribute : attribute '"+ attributeName + "' not found in context. Check tag syntax" );
else
return SKIP_BODY;
if( scopeName != null )
{
scope = TagUtils.getScope( scopeName, PageContext.PAGE_SCOPE );
if(scope!=ComponentConstants.COMPONENT_SCOPE)
pageContext.setAttribute(localId, value, scope);
}
else
pageContext.setAttribute(localId, value);
// Continue processing this page
return SKIP_BODY;
}
PutTag.java 文件源码
项目:lams
阅读 28
收藏 0
点赞 0
评论 0
/**
* Do end tag.
*/
public int doEndTag() throws JspException {
// Call parent tag which in turn does what it want
callParent();
// clean up tag handler for reuse.
releaseInternal();
return EVAL_PAGE;
}
MultiLinesOutputTag.java 文件源码
项目:lams
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void doTag() throws JspException, IOException {
if (escapeHtml) {
value = HtmlUtils.htmlEscape(value);
}
value = value.replaceAll("\n", "<br>");
getJspContext().getOut().write(value.toString());
}
NestedRootTag.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
/**
* Render the resulting content evaluation.
*
* @return int JSP continuation directive.
*/
public int doAfterBody() throws JspException {
/* Render the output */
if (bodyContent != null) {
TagUtils.getInstance().writePrevious(pageContext, bodyContent.getString());
bodyContent.clearBody();
}
return (SKIP_BODY);
}
IterateTag.java 文件源码
项目:lams
阅读 28
收藏 0
点赞 0
评论 0
/**
* Make the next collection element available and loop, or
* finish the iterations if there are no more elements.
*
* @exception JspException if a JSP exception has occurred
*/
public int doAfterBody() throws JspException {
// Render the output from this iteration to the output stream
if (bodyContent != null) {
TagUtils.getInstance().writePrevious(pageContext, bodyContent.getString());
bodyContent.clearBody();
}
// Decide whether to iterate or quit
if ((lengthValue > 0) && (lengthCount >= lengthValue)) {
return (SKIP_BODY);
}
if (iterator.hasNext()) {
Object element = iterator.next();
if (element == null) {
pageContext.removeAttribute(id);
} else {
pageContext.setAttribute(id, element);
}
lengthCount++;
if (indexId != null) {
pageContext.setAttribute(indexId, new Integer(getIndex()));
}
return (EVAL_BODY_TAG);
} else {
return (SKIP_BODY);
}
}
CookieTag.java 文件源码
项目:lams
阅读 29
收藏 0
点赞 0
评论 0
/**
* Retrieve the required property and expose it as a scripting variable.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException {
// Retrieve the required cookie value(s)
ArrayList values = new ArrayList();
Cookie cookies[] =
((HttpServletRequest) pageContext.getRequest()).getCookies();
if (cookies == null)
cookies = new Cookie[0];
for (int i = 0; i < cookies.length; i++) {
if (name.equals(cookies[i].getName()))
values.add(cookies[i]);
}
if ((values.size() < 1) && (value != null))
values.add(new Cookie(name, value));
if (values.size() < 1) {
JspException e = new JspException
(messages.getMessage("cookie.get", name));
TagUtils.getInstance().saveException(pageContext, e);
throw e;
}
// Expose an appropriate variable containing these results
if (multiple == null) {
Cookie cookie = (Cookie) values.get(0);
pageContext.setAttribute(id, cookie);
} else {
cookies = new Cookie[values.size()];
pageContext.setAttribute(id, values.toArray(cookies));
}
return (SKIP_BODY);
}
NestedMatchTag.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
/**
* Overriding method of the heart of the matter. Gets the relative property
* and leaves the rest up to the original tag implementation. Sweet.
* @return int JSP continuation directive.
* This is in the hands of the super class.
*/
public int doStartTag() throws JspException {
// get the original properties
originalName = getName();
originalProperty = getProperty();
// request
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
// set the properties
NestedPropertyHelper.setNestedProperties(request, this);
// let the super do it's thing
return super.doStartTag();
}
CardTag.java 文件源码
项目:chunk-reader
阅读 27
收藏 0
点赞 0
评论 0
/**
* Print the title card
* @throws JspException jsp exception
* @throws IOException io exception
*/
protected void printTitle() throws JspException, IOException {
CardTitleTag cardTitleTag = new CardTitleTag();
cardTitleTag.setTitle(title);
if (titleID != null) {
cardTitleTag.setId(titleID);
}
if (titleColorCSS != null) {
cardTitleTag.setCustomClasses(titleColorCSS);
cardTitleTag.addAdditionalAttributeString(" style='color:white'");
}
cardTitleTag.setParent(this);
cardTitleTag.doTag();
}
LogTag.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 25
收藏 0
点赞 0
评论 0
@Override
public int doAfterBody() throws JspException {
try {
String s = bodyOut.getString();
System.err.println(s);
if (toBrowser)
bodyOut.writeOut(bodyOut.getEnclosingWriter());
return SKIP_BODY;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
MultiboxTag.java 文件源码
项目:lams
阅读 23
收藏 0
点赞 0
评论 0
/**
* Save the body contents of this tag as the constant that we will
* be returning.
*
* @exception JspException if a JSP exception has occurred
*/
public int doAfterBody() throws JspException {
if (bodyContent != null) {
this.constant = bodyContent.getString().trim();
}
if ("".equals(this.constant)) {
this.constant = null;
}
return SKIP_BODY;
}
HeadTag.java 文件源码
项目:chunk-reader
阅读 38
收藏 0
点赞 0
评论 0
@Override
public void doTag() throws JspException, IOException {
printContent("<meta charset=\"UTF-8\">");
printContent("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">");
printContent("<meta name=\"description\" content=\"Official Website of Sam\">");
printContent("<title>" + title +"</title>");
printContent("<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />");
printContent("<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/material-design-lite/1.3.0/material.deep_orange-red.min.css\" />");
printContent("<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" />");
printContent("<link rel=\"stylesheet\" href=\"/framework/css/base.css\" />");
printContent("<script defer src=\"https://cdnjs.cloudflare.com/ajax/libs/material-design-lite/1.3.0/material.min.js\"></script>");
printContent("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>");
printContent("<link rel=\"shortcut icon\" href=\"/favicon.ico?v=2\" />");
}
NestedLinkTag.java 文件源码
项目:lams
阅读 29
收藏 0
点赞 0
评论 0
/**
* Complete the processing of the tag. The nested tags here will restore
* all the original value for the tag itself and the nesting context.
* @return int to describe the next step for the JSP processor
* @throws JspException for the bad things JSP's do
*/
public int doEndTag() throws JspException {
// do the super's ending part
int i = super.doEndTag();
// reset the properties
setName(origName);
setProperty(origProperty);
setParamProperty(origParamProperty);
// continue
return i;
}
CustomTag.java 文件源码
项目:jaffa-framework
阅读 39
收藏 0
点赞 0
评论 0
/**
* This method is called when the JSP engine encounters the start tag,
* after the attributes are processed.
* Scripting variables (if any) have their values set here.
* @return EVAL_BODY_TAG if the JSP engine should evaluate the tag body, otherwise return SKIP_BODY.
* This method is automatically generated. Do not modify this method.
* Instead, modify the methods that this method calls.
*
*/
public int doStartTag() throws JspException {
if(log.isDebugEnabled())
log.debug(this.NAME + ".doStartTag() - From CustomTag.doStartTag()");
otherDoStartTagOperations();
if (theBodyShouldBeEvaluated()) {
if(IBodyTag.class.isInstance(this))
// See if we are evaluating the body
return EVAL_BODY_BUFFERED;
else
return EVAL_BODY_INCLUDE;
} else {
return SKIP_BODY;
}
}