mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
ww-1266
git-svn-id: https://svn.apache.org/repos/asf/incubator/webwork2@396239 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -148,7 +148,8 @@ public class URL extends Component {
|
||||
// no explicit url set so attach params from current url, do
|
||||
// this at start so body params can override any of these they wish.
|
||||
try {
|
||||
String includeParams = null;
|
||||
// ww-1266
|
||||
String includeParams = GET;
|
||||
|
||||
if (this.includeParams != null) {
|
||||
includeParams = findString(this.includeParams);
|
||||
|
||||
@@ -17,8 +17,17 @@
|
||||
*/
|
||||
package org.apache.struts.action2.views.jsp;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
|
||||
import org.apache.struts.action2.components.URL;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
import com.opensymphony.xwork.util.OgnlValueStack;
|
||||
|
||||
/**
|
||||
* Unit test for {@link URLTag}.
|
||||
*
|
||||
@@ -27,6 +36,31 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
|
||||
private URLTag tag;
|
||||
|
||||
public void testIncludeParamsDefaultToGET() throws Exception {
|
||||
request.setQueryString("one=oneVal&two=twoVal&three=threeVal");
|
||||
|
||||
// request parameter map should not have any effect, as includeParams
|
||||
// default to GET, which get its param from request.getQueryString()
|
||||
Map tmp = new HashMap();
|
||||
tmp.put("one", "aaa");
|
||||
tmp.put("two", "bbb");
|
||||
tmp.put("three", "ccc");
|
||||
request.setParameterMap(tmp);
|
||||
|
||||
tag.setValue("TestAction.acton");
|
||||
|
||||
tag.doStartTag();
|
||||
|
||||
URL url = (URL) tag.getComponent();
|
||||
Map parameters = url.getParameters();
|
||||
|
||||
tag.doEndTag();
|
||||
|
||||
assertEquals(parameters.get("one"), "oneVal");
|
||||
assertEquals(parameters.get("two"), "twoVal");
|
||||
assertEquals(parameters.get("three"), "threeVal");
|
||||
}
|
||||
|
||||
public void testActionURL() throws Exception {
|
||||
tag.setValue("TestAction.action");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user