You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2006/12/31 06:53:22 UTC

svn commit: r491393 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/ main/java/org/apache/struts2/components/ main/java/org/apache/struts2/views/ main/java/org/apache/struts2/views/freemarker/ main/java/org/apache/struts2/views/veloci...

Author: mrdon
Date: Sat Dec 30 21:53:21 2006
New Revision: 491393

URL: http://svn.apache.org/viewvc?view=rev&rev=491393
Log:
Created concept of a tag library that ties together freemarker and velocity tags, made it possible
for plugins to provide new tag libraries, fixed form component to have object factory injected rather
than relying on threadlocal instance

WW-1584 WW-1580

Added:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/DefaultTagLibrary.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/TagLibrary.java
Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
    struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
    struts/struts2/trunk/core/src/main/resources/struts-default.xml
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/SettingsTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java Sat Dec 30 21:53:21 2006
@@ -142,6 +142,8 @@
     public static final String STRUTS_ACTIONPROXYFACTORY = "struts.actionProxyFactory";
 
     public static final String STRUTS_TEMPLATE_ENGINES = "struts.templateEngines";
+    
+    public static final String STRUTS_TAG_LIBRARIES = "struts.tagLibraries";
 
     public static final String STRUTS_FREEMARKER_WRAPPER_ALT_MAP = "struts.freemarker.wrapper.altMap";
 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java Sat Dec 30 21:53:21 2006
@@ -113,6 +113,7 @@
     
     protected boolean enableDynamicMethodInvocation = true;
     protected Configuration configuration;
+    protected ObjectFactory objectFactory;
 
     public Form(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
         super(stack, request, response);
@@ -139,6 +140,11 @@
     public void setConfiguration(Configuration configuration) {
         this.configuration = configuration;
     }
+    
+    @Inject
+    public void setObjectFactory(ObjectFactory objectFactory) {
+        this.objectFactory = objectFactory;
+    }
 
 
     /*
@@ -267,7 +273,7 @@
             // this can be used for getting the list of validators
             addParameter("actionName", actionName);
             try {
-                Class clazz = ObjectFactory.getObjectFactory().getClassInstance(actionConfig.getClassName());
+                Class clazz = objectFactory.getClassInstance(actionConfig.getClassName());
                 addParameter("actionClass", clazz);
             } catch (ClassNotFoundException e) {
                 // this is OK, we'll just move on

Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/DefaultTagLibrary.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/DefaultTagLibrary.java?view=auto&rev=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/DefaultTagLibrary.java (added)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/DefaultTagLibrary.java Sat Dec 30 21:53:21 2006
@@ -0,0 +1,116 @@
+package org.apache.struts2.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.views.freemarker.tags.StrutsModels;
+import org.apache.struts2.views.velocity.components.ActionDirective;
+import org.apache.struts2.views.velocity.components.ActionErrorDirective;
+import org.apache.struts2.views.velocity.components.ActionMessageDirective;
+import org.apache.struts2.views.velocity.components.AnchorDirective;
+import org.apache.struts2.views.velocity.components.AutocompleterDirective;
+import org.apache.struts2.views.velocity.components.BeanDirective;
+import org.apache.struts2.views.velocity.components.CheckBoxDirective;
+import org.apache.struts2.views.velocity.components.CheckBoxListDirective;
+import org.apache.struts2.views.velocity.components.ComboBoxDirective;
+import org.apache.struts2.views.velocity.components.ComponentDirective;
+import org.apache.struts2.views.velocity.components.DateDirective;
+import org.apache.struts2.views.velocity.components.DatePickerDirective;
+import org.apache.struts2.views.velocity.components.DivDirective;
+import org.apache.struts2.views.velocity.components.DoubleSelectDirective;
+import org.apache.struts2.views.velocity.components.DropdownDateTimePickerDirective;
+import org.apache.struts2.views.velocity.components.FieldErrorDirective;
+import org.apache.struts2.views.velocity.components.FileDirective;
+import org.apache.struts2.views.velocity.components.FormDirective;
+import org.apache.struts2.views.velocity.components.HeadDirective;
+import org.apache.struts2.views.velocity.components.HiddenDirective;
+import org.apache.struts2.views.velocity.components.I18nDirective;
+import org.apache.struts2.views.velocity.components.IncludeDirective;
+import org.apache.struts2.views.velocity.components.LabelDirective;
+import org.apache.struts2.views.velocity.components.OptionTransferSelectDirective;
+import org.apache.struts2.views.velocity.components.ParamDirective;
+import org.apache.struts2.views.velocity.components.PasswordDirective;
+import org.apache.struts2.views.velocity.components.PropertyDirective;
+import org.apache.struts2.views.velocity.components.PushDirective;
+import org.apache.struts2.views.velocity.components.RadioDirective;
+import org.apache.struts2.views.velocity.components.ResetDirective;
+import org.apache.struts2.views.velocity.components.SelectDirective;
+import org.apache.struts2.views.velocity.components.SetDirective;
+import org.apache.struts2.views.velocity.components.SubmitDirective;
+import org.apache.struts2.views.velocity.components.TabbedPanelDirective;
+import org.apache.struts2.views.velocity.components.TextAreaDirective;
+import org.apache.struts2.views.velocity.components.TextDirective;
+import org.apache.struts2.views.velocity.components.TextFieldDirective;
+import org.apache.struts2.views.velocity.components.TokenDirective;
+import org.apache.struts2.views.velocity.components.TreeDirective;
+import org.apache.struts2.views.velocity.components.TreeNodeDirective;
+import org.apache.struts2.views.velocity.components.URLDirective;
+import org.apache.struts2.views.velocity.components.UpDownSelectDirective;
+import org.apache.struts2.views.velocity.components.WebTableDirective;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * The default Struts tag library
+ */
+public class DefaultTagLibrary implements TagLibrary {
+
+    public Object getFreemarkerModels(ValueStack stack, HttpServletRequest req,
+            HttpServletResponse res) {
+        
+        return new StrutsModels(stack, req, res);
+    }
+
+    public List<Class> getVelocityDirectiveClasses() {
+        Class[] directives = new Class[] {
+            ActionDirective.class,
+            BeanDirective.class,
+            CheckBoxDirective.class,
+            CheckBoxListDirective.class,
+            ComboBoxDirective.class,
+            ComponentDirective.class,
+            DateDirective.class,
+            DatePickerDirective.class,
+            DropdownDateTimePickerDirective.class,
+            DivDirective.class,
+            AutocompleterDirective.class,
+            DoubleSelectDirective.class,
+            FileDirective.class,
+            FormDirective.class,
+            HeadDirective.class,
+            HiddenDirective.class,
+            AnchorDirective.class,
+            I18nDirective.class,
+            IncludeDirective.class,
+            LabelDirective.class,
+            ParamDirective.class,
+            PasswordDirective.class,
+            PushDirective.class,
+            PropertyDirective.class,
+            RadioDirective.class,
+            SelectDirective.class,
+            SetDirective.class,
+            SubmitDirective.class,
+            ResetDirective.class,
+            TabbedPanelDirective.class,
+            TextAreaDirective.class,
+            TextDirective.class,
+            TextFieldDirective.class,
+            TokenDirective.class,
+            TreeDirective.class,
+            TreeNodeDirective.class,
+            URLDirective.class,
+            WebTableDirective.class,
+            ActionErrorDirective.class,
+            ActionMessageDirective.class,
+            FieldErrorDirective.class,
+            OptionTransferSelectDirective.class,
+            UpDownSelectDirective.class
+        };
+        return Arrays.asList(directives);
+    }
+
+}

Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/TagLibrary.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/TagLibrary.java?view=auto&rev=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/TagLibrary.java (added)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/TagLibrary.java Sat Dec 30 21:53:21 2006
@@ -0,0 +1,33 @@
+package org.apache.struts2.views;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * Provides Velocity and Freemarker implementation classes for a tag library
+ */
+public interface TagLibrary {
+
+    /**
+     * Gets a Java object that contains getters for the tag library's Freemarker models.  
+     * Called once per Freemarker template processing.
+     * 
+     * @param stack The current value stack
+     * @param req The HTTP request
+     * @param res The HTTP response
+     * @return The Java object containing the Freemarker model getter methods
+     */
+    public Object getFreemarkerModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res);
+    
+    /**
+     * Gets a list of Velocity directive classes for the tag library.  Called once on framework
+     * startup when initializing Velocity.
+     * 
+     * @return A list of Velocity directive classes
+     */
+    public List<Class> getVelocityDirectiveClasses();
+}

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java Sat Dec 30 21:53:21 2006
@@ -23,8 +23,13 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import javax.servlet.GenericServlet;
 import javax.servlet.ServletContext;
@@ -36,9 +41,11 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.views.JspSupportServlet;
+import org.apache.struts2.views.TagLibrary;
 import org.apache.struts2.views.freemarker.tags.StrutsModels;
 import org.apache.struts2.views.util.ContextUtil;
 
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.FileManager;
 import com.opensymphony.xwork2.util.ValueStack;
@@ -117,6 +124,9 @@
     
     private String encoding;
     private boolean altMapWrapper;
+    private Map<String,TagLibrary> tagLibraries;
+    private String tagLibraryPrefixes;
+    private Container container;
     
     
     @Inject(StrutsConstants.STRUTS_I18N_ENCODING)
@@ -128,6 +138,28 @@
     public void setWrapperAltMap(String val) {
         altMapWrapper = "true".equals(val);
     }
+    
+    @Inject(StrutsConstants.STRUTS_TAG_LIBRARIES)
+    public void setTagLibraryPrefixes(String libnames) {
+        this.tagLibraryPrefixes = libnames;
+    }
+    
+    @Inject
+    public void setContainer(Container container) {
+        this.container = container;
+    }
+    
+    /*
+    @Inject
+    public void setContainer(Container container) {
+        Map<String,TagLibrary> map = new HashMap<String,TagLibrary>();
+        Set<String> prefixes = container.getInstanceNames(TagLibrary.class);
+        for (String prefix : prefixes) {
+            map.put(prefix, container.getInstance(TagLibrary.class, prefix));
+        }
+        this.tagLibraries = Collections.unmodifiableMap(map);
+    }
+    */
 
     public final synchronized freemarker.template.Configuration getConfiguration(ServletContext servletContext) throws TemplateException {
         freemarker.template.Configuration config = (freemarker.template.Configuration) servletContext.getAttribute(CONFIG_SERVLET_CONTEXT_KEY);
@@ -138,6 +170,17 @@
             // store this configuration in the servlet context
             servletContext.setAttribute(CONFIG_SERVLET_CONTEXT_KEY, config);
         }
+        
+        if (tagLibraries == null && tagLibraryPrefixes != null) {
+            Map<String,TagLibrary> map = new HashMap<String,TagLibrary>();
+            List<TagLibrary> list = new ArrayList<TagLibrary>();
+            TagLibrary lib = null;
+            String[] prefixes = tagLibraryPrefixes.split(",");
+            for (String prefix : prefixes) {
+                map.put(prefix, container.getInstance(TagLibrary.class, prefix));
+            }
+            this.tagLibraries = Collections.unmodifiableMap(map);
+        }
 
         config.setWhitespaceStripping(true);
 
@@ -318,7 +361,9 @@
     public SimpleHash buildTemplateModel(ValueStack stack, Object action, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, ObjectWrapper wrapper) {
         ScopesHashModel model = buildScopesHashModel(servletContext, request, response, wrapper, stack);
         populateContext(model, stack, action, request, response);
-        model.put("s", new StrutsModels(stack, request, response));
+        for (String prefix : tagLibraries.keySet()) {
+            model.put(prefix, tagLibraries.get(prefix).getFreemarkerModels(stack, request, response));
+        }
         return model;
     }
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java Sat Dec 30 21:53:21 2006
@@ -25,10 +25,13 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 import java.util.StringTokenizer;
 
 import javax.servlet.ServletContext;
@@ -41,51 +44,9 @@
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.util.VelocityStrutsUtil;
+import org.apache.struts2.views.TagLibrary;
 import org.apache.struts2.views.jsp.ui.OgnlTool;
 import org.apache.struts2.views.util.ContextUtil;
-import org.apache.struts2.views.velocity.components.ActionDirective;
-import org.apache.struts2.views.velocity.components.ActionErrorDirective;
-import org.apache.struts2.views.velocity.components.ActionMessageDirective;
-import org.apache.struts2.views.velocity.components.AnchorDirective;
-import org.apache.struts2.views.velocity.components.AutocompleterDirective;
-import org.apache.struts2.views.velocity.components.BeanDirective;
-import org.apache.struts2.views.velocity.components.CheckBoxDirective;
-import org.apache.struts2.views.velocity.components.CheckBoxListDirective;
-import org.apache.struts2.views.velocity.components.ComboBoxDirective;
-import org.apache.struts2.views.velocity.components.ComponentDirective;
-import org.apache.struts2.views.velocity.components.DateDirective;
-import org.apache.struts2.views.velocity.components.DatePickerDirective;
-import org.apache.struts2.views.velocity.components.DivDirective;
-import org.apache.struts2.views.velocity.components.DoubleSelectDirective;
-import org.apache.struts2.views.velocity.components.DropdownDateTimePickerDirective;
-import org.apache.struts2.views.velocity.components.FieldErrorDirective;
-import org.apache.struts2.views.velocity.components.FileDirective;
-import org.apache.struts2.views.velocity.components.FormDirective;
-import org.apache.struts2.views.velocity.components.HeadDirective;
-import org.apache.struts2.views.velocity.components.HiddenDirective;
-import org.apache.struts2.views.velocity.components.I18nDirective;
-import org.apache.struts2.views.velocity.components.IncludeDirective;
-import org.apache.struts2.views.velocity.components.LabelDirective;
-import org.apache.struts2.views.velocity.components.OptionTransferSelectDirective;
-import org.apache.struts2.views.velocity.components.ParamDirective;
-import org.apache.struts2.views.velocity.components.PasswordDirective;
-import org.apache.struts2.views.velocity.components.PropertyDirective;
-import org.apache.struts2.views.velocity.components.PushDirective;
-import org.apache.struts2.views.velocity.components.RadioDirective;
-import org.apache.struts2.views.velocity.components.ResetDirective;
-import org.apache.struts2.views.velocity.components.SelectDirective;
-import org.apache.struts2.views.velocity.components.SetDirective;
-import org.apache.struts2.views.velocity.components.SubmitDirective;
-import org.apache.struts2.views.velocity.components.TabbedPanelDirective;
-import org.apache.struts2.views.velocity.components.TextAreaDirective;
-import org.apache.struts2.views.velocity.components.TextDirective;
-import org.apache.struts2.views.velocity.components.TextFieldDirective;
-import org.apache.struts2.views.velocity.components.TokenDirective;
-import org.apache.struts2.views.velocity.components.TreeDirective;
-import org.apache.struts2.views.velocity.components.TreeNodeDirective;
-import org.apache.struts2.views.velocity.components.URLDirective;
-import org.apache.struts2.views.velocity.components.UpDownSelectDirective;
-import org.apache.struts2.views.velocity.components.WebTableDirective;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
 import org.apache.velocity.app.VelocityEngine;
@@ -95,6 +56,7 @@
 import org.apache.velocity.tools.view.servlet.ServletToolboxManager;
 
 import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
 
@@ -135,6 +97,12 @@
     private Properties velocityProperties;
 
     private String customConfigFile;
+    
+    private String tagLibraryPrefixes;
+    
+    private List<TagLibrary> tagLibraries;
+    
+    private Container container;
 
     public VelocityManager() {
     }
@@ -143,6 +111,16 @@
     public void setObjectFactory(ObjectFactory fac) {
         this.objectFactory = fac;
     }
+    
+    @Inject(StrutsConstants.STRUTS_TAG_LIBRARIES)
+    public void setTagLibraryPrefixes(String libnames) {
+        this.tagLibraryPrefixes = libnames;
+    }
+    
+    @Inject
+    public void setContainer(Container container) {
+        this.container = container;
+    }
 
     /**
      * retrieve an instance to the current VelocityManager
@@ -268,6 +246,16 @@
         if (velocityEngine == null) {
             velocityEngine = newVelocityEngine(context);
         }
+        if (tagLibraries == null && tagLibraryPrefixes != null) {
+            List<TagLibrary> list = new ArrayList<TagLibrary>();
+            TagLibrary lib = null;
+            String[] prefixes = tagLibraryPrefixes.split(",");
+            for (String prefix : prefixes) {
+                list.add(container.getInstance(TagLibrary.class, prefix));
+            }
+            this.tagLibraries = Collections.unmodifiableList(list);
+            
+        }
         this.initToolbox(context);
     }
 
@@ -566,50 +554,13 @@
 
         // components
         StringBuffer sb = new StringBuffer();
-
-        addDirective(sb, ActionDirective.class);
-        addDirective(sb, BeanDirective.class);
-        addDirective(sb, CheckBoxDirective.class);
-        addDirective(sb, CheckBoxListDirective.class);
-        addDirective(sb, ComboBoxDirective.class);
-        addDirective(sb, ComponentDirective.class);
-        addDirective(sb, DateDirective.class);
-        addDirective(sb, DatePickerDirective.class);
-        addDirective(sb, DropdownDateTimePickerDirective.class);
-        addDirective(sb, DivDirective.class);
-        addDirective(sb, AutocompleterDirective.class);
-        addDirective(sb, DoubleSelectDirective.class);
-        addDirective(sb, FileDirective.class);
-        addDirective(sb, FormDirective.class);
-        addDirective(sb, HeadDirective.class);
-        addDirective(sb, HiddenDirective.class);
-        addDirective(sb, AnchorDirective.class);
-        addDirective(sb, I18nDirective.class);
-        addDirective(sb, IncludeDirective.class);
-        addDirective(sb, LabelDirective.class);
-        addDirective(sb, ParamDirective.class);
-        addDirective(sb, PasswordDirective.class);
-        addDirective(sb, PushDirective.class);
-        addDirective(sb, PropertyDirective.class);
-        addDirective(sb, RadioDirective.class);
-        addDirective(sb, SelectDirective.class);
-        addDirective(sb, SetDirective.class);
-        addDirective(sb, SubmitDirective.class);
-        addDirective(sb, ResetDirective.class);
-        addDirective(sb, TabbedPanelDirective.class);
-        addDirective(sb, TextAreaDirective.class);
-        addDirective(sb, TextDirective.class);
-        addDirective(sb, TextFieldDirective.class);
-        addDirective(sb, TokenDirective.class);
-        addDirective(sb, TreeDirective.class);
-        addDirective(sb, TreeNodeDirective.class);
-        addDirective(sb, URLDirective.class);
-        addDirective(sb, WebTableDirective.class);
-        addDirective(sb, ActionErrorDirective.class);
-        addDirective(sb, ActionMessageDirective.class);
-        addDirective(sb, FieldErrorDirective.class);
-        addDirective(sb, OptionTransferSelectDirective.class);
-        addDirective(sb, UpDownSelectDirective.class);
+        
+        for (TagLibrary tagLibrary : tagLibraries) {
+            List<Class> directives = tagLibrary.getVelocityDirectiveClasses();
+            for (Class directive : directives) {
+                addDirective(sb, directive);
+            }
+        }
 
         String directives = sb.toString();
 

Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties Sat Dec 30 21:53:21 2006
@@ -158,4 +158,7 @@
 ### A list of template engines available
 struts.templateEngines=ftl,jsp,vm
 
+### A list of tag libraries available
+struts.tagLibraries=s
+
 ### END SNIPPET: complete_file

Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Sat Dec 30 21:53:21 2006
@@ -23,6 +23,8 @@
     <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true"/>
     <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakarta" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true" />
     
+    <bean type="org.apache.struts2.views.TagLibrary" name="s" class="org.apache.struts2.views.DefaultTagLibrary" />
+    
     <bean class="org.apache.struts2.views.freemarker.FreemarkerManager" name="struts" optional="true"/>
     <bean class="org.apache.struts2.views.velocity.VelocityManager" name="struts" optional="true" />
     

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/SettingsTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/SettingsTest.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/SettingsTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/SettingsTest.java Sat Dec 30 21:53:21 2006
@@ -48,7 +48,7 @@
         assertEquals("de", locale.getLanguage());
 
         int count = getKeyCount();
-        assertEquals(35, count);
+        assertEquals(36, count);
     }
 
     public void testDefaultResourceBundlesLoaded() {

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java Sat Dec 30 21:53:21 2006
@@ -20,7 +20,6 @@
  */
 package org.apache.struts2.views.freemarker;
 
-import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsTestCase;
 import org.apache.struts2.views.jsp.StrutsMockServletContext;
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java?view=diff&rev=491393&r1=491392&r2=491393
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java Sat Dec 30 21:53:21 2006
@@ -24,6 +24,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.TestAction;
@@ -132,6 +133,7 @@
                         public void setScopeStrategy(Strategy scopeStrategy) {}
                         public <T> T getInstance(Class<T> type, String name) {return null;}
                         public <T> T getInstance(Class<T> type) {return null;}
+                        public Set<String> getInstanceNames(Class<?> type) {return null;}
 
                         public void inject(Object o) {
                             cont.inject(o);
@@ -158,6 +160,9 @@
 
                                     return interceptors;
                                 }
+                                public String getClassName() {
+                                    return ActionSupport.class.getName();
+                                }
                             };
                             return actionConfig;
                         }
@@ -233,6 +238,7 @@
                         public void setScopeStrategy(Strategy scopeStrategy) {}
                         public <T> T getInstance(Class<T> type, String name) {return null;}
                         public <T> T getInstance(Class<T> type) {return null;}
+                        public Set<String> getInstanceNames(Class<?> type) {return null;}
 
                         public void inject(Object o) {
                             cont.inject(o);
@@ -258,6 +264,9 @@
                                     interceptors.add(interceptorMapping);
 
                                     return interceptors;
+                                }
+                                public String getClassName() {
+                                    return ActionSupport.class.getName();
                                 }
                             };
                             return actionConfig;