Author: dolander
Date: Thu Mar 10 08:13:42 2005
New Revision: 156958
URL: http://svn.apache.org/viewcvs?view=rev&rev=156958
Log:
Jira 423 -- Parameters set on a button that doesn't also specify an action
were not being posted when the button is pressed.
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RewriteURL.java
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/location/index.jsp
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java?view=diff&r1=156957&r2=156958
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
Thu Mar 10 08:13:42 2005
@@ -303,7 +303,14 @@
_action = parentForm.getAction();
}
}
-
+
+ if (_action == null && _params != null && _popupSupport == null) {
+ Form parentForm = getNearestForm();
+ if (parentForm != null) {
+ _action = parentForm.getAction();
+ }
+ }
+
if (_action != null) {
boolean isAction = PageFlowTagUtils.isAction(request, _action);
if (isAction) {
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RewriteURL.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RewriteURL.java?view=diff&r1=156957&r2=156958
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RewriteURL.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RewriteURL.java
Thu Mar 10 08:13:42 2005
@@ -24,12 +24,15 @@
import org.apache.beehive.netui.tags.AbstractClassicTag;
import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
import org.apache.beehive.netui.util.Bundle;
+import org.apache.beehive.netui.util.ParamHelper;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
/**
* Allow a name, typically either an id or name attribute, to participate in
URL
@@ -53,8 +56,9 @@
* bodycontentpref="empty"
* whitespace="indent"
*/
-public class RewriteURL extends AbstractClassicTag
+public class RewriteURL extends AbstractClassicTag implements IUrlParams
{
+ private Map _params; // Any parameters to the
submit
protected String url = null;
/**
@@ -80,6 +84,25 @@
}
/**
+ * This method will allow a tag that produces one or more Urls to have
parameters set
+ * on the tag. The name and value should be required. The facet is
optional, and
+ * allows tags producing more than one URL to have parameters set on
different URLs.
+ *
+ * @param name The name of the parameter to be added to the URL.
+ * @param value The value of the parameter.
+ * @param facet The name of a facet for which the parameter should be
added.
+ * @throws javax.servlet.jsp.JspException
+ */
+ public void addParameter(String name, Object value, String facet)
+ throws JspException
+ {
+ if (_params == null) {
+ _params = new HashMap();
+ }
+ ParamHelper.addParam(_params, name, value);
+ }
+
+ /**
* Add the URL parameter to the Parameter's parent.
* @throws JspException if a JSP exception has occurred
*/
@@ -93,6 +116,9 @@
try {
boolean needsToBeSecure = false;
uri = new FreezableMutableURI(url);
+ if (_params != null) {
+ uri.addParameters(_params, false );
+ }
uri.setEncoding(response.getCharacterEncoding());
if (!uri.isAbsolute() && PageFlowUtils.needsToBeSecure(context,
request, url, true)) {
needsToBeSecure = true;
@@ -121,6 +147,8 @@
protected void localRelease()
{
super.localRelease();
+ _params = null;
url = null;
}
+
}
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/location/index.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/location/index.jsp?view=diff&r1=156957&r2=156958
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/location/index.jsp
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/location/index.jsp
Thu Mar 10 08:13:42 2005
@@ -17,7 +17,7 @@
<netui:form action="post" location="label">
<input type="hidden" name="foo" value="value">
<netui:button value="submit">
- <netui:parameter name="submit" value="extra" />
+
</netui:button><br>
<netui:anchor formSubmit="true">Submit the form
<netui:parameter name="submit" value="link" />