Anonymous committed 61405d4

One more bit of cleanup to make sure the correct value stack is available for the tags in a view rendered by an action called via the action tag.


Comments (0)

Files changed (1)


 package com.opensymphony.webwork.views.jsp;
 import com.opensymphony.webwork.WebWorkStatics;
+import com.opensymphony.webwork.ServletActionContext;
 import com.opensymphony.webwork.dispatcher.ApplicationMap;
 import com.opensymphony.webwork.dispatcher.RequestMap;
 import com.opensymphony.webwork.dispatcher.ServletDispatcher;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.JspException;
         String namespace;
+        final ServletRequest request = pageContext.getRequest();
         if (namespaceAttr == null) {
-            namespace = TagUtils.buildNamespace(getStack(), (HttpServletRequest) pageContext.getRequest());
+            namespace = TagUtils.buildNamespace(getStack(), (HttpServletRequest) request);
         } else {
             namespace = findString(namespaceAttr);
         // execute at this point, after params have been set
         try {
+            // get the old value stack from the request
+            OgnlValueStack stack = getStack();
             proxy = ActionProxyFactory.getFactory().createActionProxy(namespace, actualName, createExtraContext(), executeResult);
+            // set the new stack into the request for the taglib to use
+            request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY,proxy.getInvocation().getStack());
+            // set the old stack back on the request
+            request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY,stack);
         } catch (Exception e) {
             log.error("Could not execute action: " + namespace + "/" + actualName, e);
         if (getId() != null) {
-            getStack().getContext().put(getId(), proxy.getAction());
+            final OgnlValueStack stack = getStack();
+            final Map context = stack.getContext();
+            context.put(getId(), proxy.getAction());
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.