Revision: 1109
          http://stripes.svn.sourceforge.net/stripes/?rev=1109&view=rev
Author:   bengunter
Date:     2009-03-06 02:02:12 +0000 (Fri, 06 Mar 2009)

Log Message:
-----------
The stripes:form tag had a problem similar to that described in STS-523. While 
there is no prependContext attribute to control whether the context path is 
prepended, I did add the trick that causes the context path to be prepended if 
"beanclass" is used because the use of beanclass always results in a relative 
path.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java

Modified: trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java  2009-03-05 
21:10:56 UTC (rev 1108)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java  2009-03-06 
02:02:12 UTC (rev 1109)
@@ -63,6 +63,14 @@
     /** Stores the value of the action attribute before the context gets 
appended. */
     private String actionWithoutContext;
 
+    /** Stores the value of the beanclass attribute. */
+    private Object beanclass;
+
+    /**
+     * The {...@link ActionBean} class to which the form will submit, as 
determined by the
+     * {...@link ActionResolver}. This may be null if the action attribute is 
set but its value does
+     * not resolve to an {...@link ActionBean}.
+     */
     private Class<? extends ActionBean> actionBeanClass;
 
     /** Builds the action attribute with parameters */
@@ -119,6 +127,8 @@
      *         because of a mis-spelled class name, or a class that's not an 
ActionBean
      */
     public void setBeanclass(Object beanclass) throws StripesJspException {
+        this.beanclass = beanclass;
+
         String url = getActionBeanUrl(beanclass);
         if (url == null) {
             throw new StripesJspException("Could not determine action from 
'beanclass' supplied. " +
@@ -485,8 +495,13 @@
         if (action.startsWith("/")) {
             HttpServletRequest request = (HttpServletRequest) 
getPageContext().getRequest();
             String contextPath = request.getContextPath();
-            if (contextPath.length() > 1 && !action.startsWith(contextPath + 
'/'))
+
+            // *Always* prepend the context path if "beanclass" was used
+            // Otherwise, *only* prepend it if it is not already present
+            if (contextPath.length() > 1
+                    && (beanclass != null || !action.startsWith(contextPath + 
'/'))) {
                 action = contextPath + action;
+            }
         }
         HttpServletResponse response = (HttpServletResponse) 
getPageContext().getResponse();
         return response.encodeURL(action);


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