Commits

Anonymous committed 6497c4b

Comments (0)

Files changed (1)

src/java/com/opensymphony/webwork/views/velocity/VelocityManager.java

 import com.opensymphony.webwork.ServletActionContext;
 import com.opensymphony.webwork.WebWorkConstants;
 import com.opensymphony.webwork.WebWorkException;
+import com.opensymphony.webwork.WebWorkStatics;
 import com.opensymphony.webwork.config.Configuration;
 import com.opensymphony.webwork.util.VelocityWebWorkUtil;
 import com.opensymphony.webwork.views.jsp.ui.OgnlTool;
         }
         context.put(WEBWORK, new VelocityWebWorkUtil(context, stack, req, res));
 
+        // populate stack with request, response and session
+        // in case we are coming  from velocity servlet without prior action
+        // invocation
+        if(stack.getContext().get(WebWorkStatics.HTTP_REQUEST) == null) {
+        	stack.getContext().put(WebWorkStatics.HTTP_REQUEST,req);
+        }
+        if(stack.getContext().get(WebWorkStatics.HTTP_RESPONSE) == null) {
+        	stack.getContext().put(WebWorkStatics.HTTP_RESPONSE,res);
+        }        
+        if(stack.getContext().get(WebWorkStatics.SERVLET_CONTEXT) == null) {
+        	stack.getContext().put(WebWorkStatics.SERVLET_CONTEXT,req.getSession().getServletContext());
+        }
+
+        
 
         ServletContext ctx = null;
         try {
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 ProjectModifiedEvent.java.
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.