Revision: 1071
          http://stripes.svn.sourceforge.net/stripes/?rev=1071&view=rev
Author:   bengunter
Date:     2009-02-27 21:02:57 +0000 (Fri, 27 Feb 2009)

Log Message:
-----------
Applied fix for STS-606 from trunk.

Modified Paths:
--------------
    branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java

Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
===================================================================
--- branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java 
2009-02-27 20:47:12 UTC (rev 1070)
+++ branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java 
2009-02-27 21:02:57 UTC (rev 1071)
@@ -81,24 +81,25 @@
      * @param action the action path, relative to the root of the web 
application
      */
     public void setAction(String action) {
-        // Use the action resolver to figure out what the appropriate URL 
binding if for
-        // this path and use that if there is one, otherwise just use the 
action passed in
-        String binding = 
StripesFilter.getConfiguration().getActionResolver().getUrlBindingFromPath(action);
-        if (binding != null) {
-            this.actionWithoutContext = binding;
-        }
-        else {
-            this.actionWithoutContext = action;
-        }
+        this.actionWithoutContext = action;
     }
 
     public String getAction() { return this.actionWithoutContext; }
 
+    /** Get the URL binding for the form's {...@link ActionBean} from the 
{...@link ActionResolver}. */
+       protected String getActionBeanUrlBinding() {
+        ActionResolver resolver = 
StripesFilter.getConfiguration().getActionResolver();
+        if (actionBeanClass == null)
+            return resolver.getUrlBindingFromPath(actionWithoutContext);
+        else
+            return resolver.getUrlBinding(actionBeanClass);
+    }
+
     /** Lazily looks up and returns the type of action bean the form will 
submit to. */
     protected Class<? extends ActionBean> getActionBeanClass() {
         if (this.actionBeanClass == null) {
             ActionResolver resolver = 
StripesFilter.getConfiguration().getActionResolver();
-            this.actionBeanClass = 
resolver.getActionBeanType(this.actionWithoutContext);
+            this.actionBeanClass = 
resolver.getActionBeanType(getActionBeanUrlBinding());
         }
 
         return this.actionBeanClass;
@@ -342,12 +343,13 @@
      * @return ActionBean the ActionBean bound to the form if there is one
      */
     protected ActionBean getActionBean() {
+               String binding = getActionBeanUrlBinding();
                HttpServletRequest request = (HttpServletRequest) 
getPageContext().getRequest();
-               ActionBean bean = (ActionBean) 
request.getAttribute(this.actionWithoutContext);
+               ActionBean bean = (ActionBean) request.getAttribute(binding);
                if (bean == null) {
                        HttpSession session = request.getSession(false);
                        if (session != null)
-                               bean = (ActionBean) 
session.getAttribute(this.actionWithoutContext);
+                               bean = (ActionBean) 
session.getAttribute(binding);
                }
                return bean;
        }
@@ -361,8 +363,7 @@
         ActionBean bean = getActionBean();
         Class<? extends ActionBean> clazz = null;
         if (bean == null) {
-            clazz = StripesFilter.getConfiguration().getActionResolver()
-                            .getActionBeanType(this.actionWithoutContext);
+            clazz = getActionBeanClass();
 
             if (clazz == null) {
                 log.error("Could not locate an ActionBean that was bound to 
the URL [",


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to