net.sourceforge.stripes.tag
Class UseActionBeanTag

java.lang.Object
  extended by net.sourceforge.stripes.tag.StripesTagSupport
      extended by net.sourceforge.stripes.tag.UseActionBeanTag
All Implemented Interfaces:
JspTag, Tag

public class UseActionBeanTag
extends StripesTagSupport

This tag supports the use of Stripes ActionBean classes as view helpers. It allows for the use of actions as the controller and then their reuse on the page, creating it if it does not exist. A typical usage pattern would be for a page that contains two types of information, the interaction with each being handled by separate ActionBean implementation. Some page events route to the first action and others to the second, but the page still requires data from both in order to render. This tag would define both ActionBeans in the page scope, creating the one that wasn't executing the event.

This class will bind parameters to a created ActionBean just as the execution of an event on an ActionBean would. It does not rebind values to ActionBeans that were previously created for execution of the action. Validation is not done during this binding, except the type conversion required for binding, and no validation errors are produced.

The binding of the ActionBean to the page scope happens whether the ActionBean is created or not, making for a consistent variable to always use when referencing the ActionBean.

Author:
Greg Hinkle, Tim Fennell

Field Summary
 
Fields inherited from class net.sourceforge.stripes.tag.StripesTagSupport
pageContext, parentTag
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
UseActionBeanTag()
           
 
Method Summary
 int doEndTag()
          Does nothing.
 int doStartTag()
          The main work method of the tag.
 String getBinding()
          Get the UrlBinding of the requested ActionBean
 String getEvent()
          The event name, if any to execute.
 String getId()
          Alias for getVar() so that the JSTL and jsp:useBean style are allowed.
 String getVar()
          Gets the name of the page scope variable to which the ActionBean will be bound.
 boolean isAlwaysExecuteEvent()
           
 boolean isExecuteResolution()
           
 boolean isValidate()
           
 void setAlwaysExecuteEvent(boolean alwaysExecuteEvent)
           
 void setBeanclass(Object beanclass)
          Sets the binding attribute by figuring out what ActionBean class is identified and then in turn finding out the appropriate URL for the ActionBean.
 void setBinding(String binding)
          Set the UrlBinding of the requested ActionBean
 void setEvent(String event)
          The event name, if any to execute.
 void setExecuteResolution(boolean executeResolution)
           
 void setId(String id)
          Alias for setVar() so that the JSTL and jsp:useBean style are allowed.
 void setValidate(boolean validate)
           
 void setVar(String var)
          Sets the name of the page scope variable to which the ActionBean will be bound.
 
Methods inherited from class net.sourceforge.stripes.tag.StripesTagSupport
getActionBeanType, getActionBeanUrl, getPageContext, getParent, getParentTag, getTagStack, popPageContextAttributes, pushPageContextAttributes, release, setPageContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UseActionBeanTag

public UseActionBeanTag()
Method Detail

doStartTag

public int doStartTag()
               throws JspException
The main work method of the tag. Looks up the action bean, instantiates it, runs binding and then runs either the named event or the default.

Specified by:
doStartTag in interface Tag
Specified by:
doStartTag in class StripesTagSupport
Returns:
SKIP_BODY in all cases.
Throws:
JspException - if the ActionBean could not be instantiate and executed

doEndTag

public int doEndTag()
Does nothing.

Specified by:
doEndTag in interface Tag
Specified by:
doEndTag in class StripesTagSupport
Returns:
EVAL_PAGE in all cases.

setBeanclass

public void setBeanclass(Object beanclass)
                  throws StripesJspException
Sets the binding attribute by figuring out what ActionBean class is identified and then in turn finding out the appropriate URL for the ActionBean.

Parameters:
beanclass - the FQN of an ActionBean class, or a Class object for one.
Throws:
StripesJspException

getBinding

public String getBinding()
Get the UrlBinding of the requested ActionBean


setBinding

public void setBinding(String binding)
Set the UrlBinding of the requested ActionBean


getEvent

public String getEvent()
The event name, if any to execute.


setEvent

public void setEvent(String event)
The event name, if any to execute.


getVar

public String getVar()
Gets the name of the page scope variable to which the ActionBean will be bound.


setVar

public void setVar(String var)
Sets the name of the page scope variable to which the ActionBean will be bound.


getId

public String getId()
Alias for getVar() so that the JSTL and jsp:useBean style are allowed.


setId

public void setId(String id)
Alias for setVar() so that the JSTL and jsp:useBean style are allowed.


isValidate

public boolean isValidate()

setValidate

public void setValidate(boolean validate)

isAlwaysExecuteEvent

public boolean isAlwaysExecuteEvent()

setAlwaysExecuteEvent

public void setAlwaysExecuteEvent(boolean alwaysExecuteEvent)

isExecuteResolution

public boolean isExecuteResolution()

setExecuteResolution

public void setExecuteResolution(boolean executeResolution)


? Copyright 2005-2006, Stripes Development Team.