Author: mrdon
Date: Sun Sep  2 20:25:47 2007
New Revision: 572226

URL: http://svn.apache.org/viewvc?rev=572226&view=rev
Log:
Added better error message when a Struts tag is used w/o its filter
WW-1969

Modified:
    
struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java

Modified: 
struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java?rev=572226&r1=572225&r2=572226&view=diff
==============================================================================
--- 
struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java
 (original)
+++ 
struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java
 Sun Sep  2 20:25:47 2007
@@ -38,6 +38,7 @@
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 
@@ -55,6 +56,11 @@
 
             HttpServletResponse res = (HttpServletResponse) 
pageContext.getResponse();
             Dispatcher du = Dispatcher.getInstance();
+            if (du == null) {
+                throw new ConfigurationException("The Struts dispatcher cannot 
be found.  This is usually caused by "+
+                        "using Struts tags without the associated filter. 
Struts tags are only usable when the request "+
+                        "has passed through its servlet filter, which 
initializes the Struts dispatcher needed for this tag.");
+            }
             Map extraContext = du.createContextMap(new RequestMap(req),
                     req.getParameterMap(),
                     new SessionMap(req),


Reply via email to