Revision: 1475
http://stripes.svn.sourceforge.net/stripes/?rev=1475&view=rev
Author: bengunter
Date: 2012-02-17 14:42:46 +0000 (Fri, 17 Feb 2012)
Log Message:
-----------
Fixed STS-831: Hash anchors (#) in form action breaks binding to ActionBean
Modified Paths:
--------------
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
branches/1.5.x/stripes/src/net/sourceforge/stripes/util/StringUtil.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
2012-02-17 04:50:52 UTC (rev 1474)
+++ branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
2012-02-17 14:42:46 UTC (rev 1475)
@@ -23,6 +23,7 @@
import net.sourceforge.stripes.util.CryptoUtil;
import net.sourceforge.stripes.util.HtmlUtil;
import net.sourceforge.stripes.util.Log;
+import net.sourceforge.stripes.util.StringUtil;
import net.sourceforge.stripes.util.UrlBuilder;
import net.sourceforge.stripes.validation.ValidationErrors;
import net.sourceforge.stripes.validation.ValidationError;
@@ -97,9 +98,10 @@
protected String getActionBeanUrlBinding() {
ActionResolver resolver =
StripesFilter.getConfiguration().getActionResolver();
if (actionBeanClass == null) {
- String binding =
resolver.getUrlBindingFromPath(actionWithoutContext);
+ String path = StringUtil.trimFragment(this.actionWithoutContext);
+ String binding = resolver.getUrlBindingFromPath(path);
if (binding == null)
- binding = actionWithoutContext;
+ binding = path;
return binding;
}
else {
Modified:
branches/1.5.x/stripes/src/net/sourceforge/stripes/util/StringUtil.java
===================================================================
--- branches/1.5.x/stripes/src/net/sourceforge/stripes/util/StringUtil.java
2012-02-17 04:50:52 UTC (rev 1474)
+++ branches/1.5.x/stripes/src/net/sourceforge/stripes/util/StringUtil.java
2012-02-17 14:42:46 UTC (rev 1475)
@@ -127,4 +127,22 @@
return buf.toString();
}
+
+ /**
+ * Return the specified URL or path string with the fragment part removed.
If the string does
+ * not contain a fragment then return the string unchanged.
+ *
+ * @param url The URL or path
+ * @return The URL or path without the fragment
+ */
+ public static String trimFragment(String url) {
+ if (url == null || url.length() < 1)
+ return url;
+
+ int index = url.indexOf('#');
+ if (index >= 0)
+ return url.substring(0, index);
+ else
+ return url;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development