webwork/src/main/webwork/action ActionSupport.java,1.47,1.48

[email protected]
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/action
In directory sc8-pr-cvs1:/tmp/cvs-serv20427/src/main/webwork/action

Modified Files:
	ActionSupport.java 
Log Message:
Added convenience method for getting current action name


Index: ActionSupport.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/action/ActionSupport.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- ActionSupport.java	17 Jun 2003 13:53:47 -0000	1.47
+++ ActionSupport.java	28 Aug 2003 01:05:12 -0000	1.48
@@ -21,12 +21,12 @@
 /**
  * This is a useful base class for WebWork Action implementations. It gives you access to
  * a set of useful functionality, including result view mapping, error handling, and i18n.
- *
+ * <p>
  * It is also possible to use this class by way of delegation instead of subclassing.
  * This is useful in the case that your action cannot use subclassing to add functionality
  *
  * @see Action
- * @author Rickard Öberg ([email protected])
+ * @author Rickard Oberg ([email protected])
  * @author Victor Salaman ([email protected])
  * @version $Revision$
  */
@@ -42,6 +42,8 @@
    protected Collection errorMessages;
    protected String command;
 
+   private String actionName = null;
+
 
    // IllegalArgumentAware implementation -----------------------------
    /*
@@ -431,4 +433,18 @@
       // Restore log
       log = LogFactory.getLog(this.getClass());
    }
+
+
+   /**
+    * This is used to get the current action's class name
+    */
+   protected String getActionName()
+   {
+       if (actionName == null)
+       {
+           String classname = getClass().getName();
+           actionName = classname.substring(classname.lastIndexOf('.') + 1);
+       }
+       return actionName;
+    }
 }




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.