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 {