webwork/src/main/webwork/view/taglib BeanTag.java,1.7,1.8
[email protected] Wed, 03 Dec 2003 23:20:02 -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-serv7953/src/main/webwork/view/taglib
Modified Files:
BeanTag.java
Log Message:
Made BeanTag extensible (for example, to be able to plug in picocontainer to instantiate beans).
Index: BeanTag.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/view/taglib/BeanTag.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- BeanTag.java 11 Nov 2003 18:39:56 -0000 1.7
+++ BeanTag.java 4 Dec 2003 07:20:00 -0000 1.8
@@ -13,8 +13,8 @@
import java.beans.Beans;
/**
- * Instantiate a JavaBean.
- *
+ * Instantiate a JavaBean.
+ * <p>
* The bean may be an action, in which it is executed before used.
* It is lazily executed, which means that you can set parameters
* by using the "param" tag.
@@ -52,14 +52,12 @@
// BodyTag implementation ----------------------------------------
public int doStartTag() throws JspException
{
- // Instantiate bean
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
String name = (String)findValue(nameAttr);
if (name == null)
throw new JspException("No bean named "+nameAttr+" found. Try putting quotes around name");
- bean = Beans.instantiate(cl, name);
+ bean = loadBean(name);
} catch (Exception e)
{
try
@@ -87,5 +85,10 @@
{
getStack().popValue();
return EVAL_PAGE;
+ }
+
+ protected Object loadBean(String name) throws Exception
+ {
+ return Beans.instantiate(Thread.currentThread().getContextClassLoader(), name);
}
}
-------------------------------------------------------
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/