webwork/src/main/webwork/view/taglib PushTag.java,NONE,1.1

[email protected] Thu, 06 Nov 2003 06:28:46 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/view/taglib
In directory sc8-pr-cvs1:/tmp/cvs-serv20505

Added Files:
	PushTag.java 
Log Message:
This tag pushes and pops a value from the value stack. It can be used
instead of the property tag for this purpose. It is more efficient than
the property tag at this because it does not evaluate the body.

--- NEW FILE: PushTag.java ---
/*
 * WebWork, Web Application Framework
 *
 * Distributable under Apache license.
 * See terms of license at opensource.org
 */
package webwork.view.taglib;

import javax.servlet.jsp.JspException;

/**
 * Find the specified value using the ValueStack and then
 * push it on top of the stack. The stack is popped when
 * the end of the tag is reached.
 *
 * @author Dick Zetterberg ([email protected])
 * @version $Revision: 1.1 $
 */
public class PushTag extends WebWorkTagSupport
{
   // Attributes ----------------------------------------------------
   protected String valueAttr;

   // Public --------------------------------------------------------
   public void setValue(String inName)
   {
      valueAttr = inName;
   }

   public int doStartTag() throws JspException
   {
   	// Find the value and push it onto the stack
      Object value = findValue(valueAttr);
      getStack().pushValue(value);
      return EVAL_BODY_INCLUDE;
   }

   public int doEndTag() throws JspException
   {
   	// Pop the value from the stack
      getStack().popValue();
      return EVAL_PAGE;
   }
}




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/