diff --git a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp index 8de2f8569..a8c839477 100644 --- a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp +++ b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp @@ -27,14 +27,14 @@ Orders - - + + diff --git a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp index e576804ae..b7ce725cb 100644 --- a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp +++ b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp @@ -27,14 +27,14 @@ Orders - - + + diff --git a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp index 2d9af8faa..918c75d5b 100644 --- a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp +++ b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp @@ -27,13 +27,13 @@ Orders - - + + diff --git a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp index e96b57a33..2b42d5498 100644 --- a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp +++ b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp @@ -27,14 +27,14 @@ Orders - - + + diff --git a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp index cfe39411a..c947db0ff 100644 --- a/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp +++ b/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp @@ -27,14 +27,14 @@ Orders - - + + diff --git a/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp b/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp index 1ae656a9b..0f0d4ed8f 100644 --- a/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp +++ b/apps/showcase/src/main/webapp/WEB-INF/decorators/main.jsp @@ -63,26 +63,26 @@ <decorator:title default="Struts2 Showcase"/> - - + + - - - + - - + + diff --git a/apps/showcase/src/main/webapp/WEB-INF/validation/ajaxFormSubmit.jsp b/apps/showcase/src/main/webapp/WEB-INF/validation/ajaxFormSubmit.jsp index fbfd233d0..3064aa251 100644 --- a/apps/showcase/src/main/webapp/WEB-INF/validation/ajaxFormSubmit.jsp +++ b/apps/showcase/src/main/webapp/WEB-INF/validation/ajaxFormSubmit.jsp @@ -72,7 +72,7 @@ - + diff --git a/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-dwr.jsp b/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-dwr.jsp index 2dc69b852..51d26e781 100644 --- a/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-dwr.jsp +++ b/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-dwr.jsp @@ -26,10 +26,10 @@ Struts2 Showcase - Validation - DWR - - - - + diff --git a/apps/showcase/src/main/webapp/WEB-INF/viewSource.jsp b/apps/showcase/src/main/webapp/WEB-INF/viewSource.jsp index 5623c54a5..1255d2a3b 100644 --- a/apps/showcase/src/main/webapp/WEB-INF/viewSource.jsp +++ b/apps/showcase/src/main/webapp/WEB-INF/viewSource.jsp @@ -64,11 +64,11 @@ - + diff --git a/core/src/main/java/org/apache/struts2/components/Link.java b/core/src/main/java/org/apache/struts2/components/Link.java index 4345c50e1..b7668494f 100644 --- a/core/src/main/java/org/apache/struts2/components/Link.java +++ b/core/src/main/java/org/apache/struts2/components/Link.java @@ -166,10 +166,5 @@ public class Link extends UIBean{ if (title != null) { addParameter("title", findString(title)); } - - if (stack.getActionContext().getSession().containsKey("nonce")) { - String nonceValue = stack.getActionContext().getSession().get("nonce").toString(); - addParameter("nonce", nonceValue); - } } } diff --git a/core/src/main/java/org/apache/struts2/components/Script.java b/core/src/main/java/org/apache/struts2/components/Script.java index f2a208193..447eaf7cd 100644 --- a/core/src/main/java/org/apache/struts2/components/Script.java +++ b/core/src/main/java/org/apache/struts2/components/Script.java @@ -168,11 +168,6 @@ public class Script extends ClosingUIBean { if (crossorigin != null) { addParameter("crossorigin", findString(crossorigin)); } - - if (stack.getActionContext().getSession().containsKey("nonce")) { - String nonceValue = stack.getActionContext().getSession().get("nonce").toString(); - addParameter("nonce", nonceValue); - } } } diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index 0e44a3b74..f584f9796 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -881,6 +881,15 @@ public abstract class UIBean extends Component { } } + // to be used with the CSP interceptor - adds the nonce value as a parameter to be accessed from ftl files + Map session = stack.getActionContext().getSession(); + if (session != null) { + if (session.containsKey("nonce")) { + String nonceValue = session.get("nonce").toString(); + addParameter("nonce", nonceValue); + } + } + evaluateExtraParams(); } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/LinkModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/LinkModel.java new file mode 100644 index 000000000..f3fa7f516 --- /dev/null +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/LinkModel.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.struts2.views.freemarker.tags; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.components.Component; +import org.apache.struts2.components.Link; + +import com.opensymphony.xwork2.util.ValueStack; + +/** + * @see Link + */ +public class LinkModel extends TagModel { + public LinkModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } + + protected Component getBean() { + return new Link(stack, req, res); + } +} diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ScriptModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ScriptModel.java new file mode 100644 index 000000000..c2a84f3c8 --- /dev/null +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ScriptModel.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.struts2.views.freemarker.tags; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.components.Component; +import org.apache.struts2.components.Script; + +import com.opensymphony.xwork2.util.ValueStack; + +/** + * @see Script + */ +public class ScriptModel extends TagModel { + public ScriptModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } + + protected Component getBean() { + return new Script(stack, req, res); + } +} diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java index 99c4686bc..819ba9556 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java @@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.opensymphony.xwork2.util.ValueStack; +import org.apache.struts2.components.Script; /** * Provides @s.tag access for various tags. @@ -73,6 +74,8 @@ public class StrutsModels { protected ElseModel elseModel; protected ElseIfModel elseIfModel; protected InputTransferSelectModel inputtransferselect; + protected ScriptModel script; + protected LinkModel link; public StrutsModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { @@ -160,6 +163,14 @@ public class StrutsModels { return label; } + public LinkModel getLink() { + if (link == null) { + link = new LinkModel(stack, req, res); + } + + return link; + } + public PasswordModel getPassword() { if (password == null) { password = new PasswordModel(stack, req, res); @@ -176,6 +187,14 @@ public class StrutsModels { return radio; } + public ScriptModel getScript() { + if (script == null) { + script = new ScriptModel(stack, req, res); + } + + return script; + } + public SelectModel getSelect() { if (select == null) { select = new SelectModel(stack, req, res); diff --git a/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl b/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl index 22a251b9b..91b03390e 100644 --- a/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl +++ b/core/src/main/resources/org/apache/struts2/interceptor/debugging/console.ftl @@ -21,7 +21,9 @@ - diff --git a/core/src/main/resources/template/css_xhtml/head.ftl b/core/src/main/resources/template/css_xhtml/head.ftl index d6c6d7f13..df9916cc8 100644 --- a/core/src/main/resources/template/css_xhtml/head.ftl +++ b/core/src/main/resources/template/css_xhtml/head.ftl @@ -18,5 +18,7 @@ * under the License. */ --> - + + rel="stylesheet" href="<@s.url value='/struts/css_xhtml/styles.css' includeParams='none' encode='false' />" type="text/css" /> <#include "/${parameters.templateDir}/simple/head.ftl" /> diff --git a/core/src/main/resources/template/simple/combobox.ftl b/core/src/main/resources/template/simple/combobox.ftl index 1a6d80504..2f6f4a9b9 100644 --- a/core/src/main/resources/template/simple/combobox.ftl +++ b/core/src/main/resources/template/simple/combobox.ftl @@ -18,7 +18,9 @@ * under the License. */ --> - - <#lt/>"/> + <#lt/> + <#lt/>" <#rt/> + <#include "/${parameters.templateDir}/simple/nonce.ftl" /> + /> <#t/> \ No newline at end of file diff --git a/core/src/main/resources/template/simple/form-close.ftl b/core/src/main/resources/template/simple/form-close.ftl index 0efea0c59..469df763a 100644 --- a/core/src/main/resources/template/simple/form-close.ftl +++ b/core/src/main/resources/template/simple/form-close.ftl @@ -21,16 +21,18 @@ <#if (parameters.customOnsubmitEnabled??)> - -<#include "/${parameters.templateDir}/${parameters.expandTheme}/form-close-tooltips.ftl" /> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/form-close-tooltips.ftl" /> \ No newline at end of file diff --git a/core/src/main/resources/template/simple/head.ftl b/core/src/main/resources/template/simple/head.ftl index 2c5484a08..15d12f996 100644 --- a/core/src/main/resources/template/simple/head.ftl +++ b/core/src/main/resources/template/simple/head.ftl @@ -18,4 +18,6 @@ * under the License. */ --> - \ No newline at end of file + \ No newline at end of file diff --git a/core/src/main/resources/template/simple/inputtransferselect.ftl b/core/src/main/resources/template/simple/inputtransferselect.ftl index 7428e056a..4eacbbd0f 100644 --- a/core/src/main/resources/template/simple/inputtransferselect.ftl +++ b/core/src/main/resources/template/simple/inputtransferselect.ftl @@ -19,7 +19,9 @@ */ --> <#if !stack.findValue("#inputtransferselect_js_included")??><#t/> - + <#assign temporaryVariable = stack.setValue("#inputtransferselect_js_included", "true") /><#t/> <#t/> diff --git a/core/src/main/resources/template/simple/link.ftl b/core/src/main/resources/template/simple/link.ftl index 6bb0944e0..31821e0c6 100644 --- a/core/src/main/resources/template/simple/link.ftl +++ b/core/src/main/resources/template/simple/link.ftl @@ -20,7 +20,8 @@ --> <#include "/${parameters.templateDir}/${parameters.expandTheme}/common-attributes.ftl" /> <#include "/${parameters.templateDir}/${parameters.expandTheme}/dynamic-attributes.ftl" /> - + +<#include "/${parameters.templateDir}/simple/nonce.ftl" /> <#if parameters.href?has_content> href="${parameters.href}"<#rt/> diff --git a/core/src/main/resources/template/simple/nonce.ftl b/core/src/main/resources/template/simple/nonce.ftl new file mode 100644 index 000000000..a124cf6db --- /dev/null +++ b/core/src/main/resources/template/simple/nonce.ftl @@ -0,0 +1,23 @@ +<#-- +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +--> +<#if parameters.nonce?has_content> + nonce="${parameters.nonce}"<#rt/> + \ No newline at end of file diff --git a/core/src/main/resources/template/simple/optiontransferselect.ftl b/core/src/main/resources/template/simple/optiontransferselect.ftl index 40b03c995..d0b328be1 100644 --- a/core/src/main/resources/template/simple/optiontransferselect.ftl +++ b/core/src/main/resources/template/simple/optiontransferselect.ftl @@ -19,7 +19,9 @@ */ --> <#if !stack.findValue("#optiontransferselect_js_included")??><#t/> - + <#assign temporaryVariable = stack.setValue("#optiontransferselect_js_included", "true") /><#t/> <#t/>
diff --git a/core/src/main/resources/template/simple/script.ftl b/core/src/main/resources/template/simple/script.ftl index f16653257..5afb30dd3 100644 --- a/core/src/main/resources/template/simple/script.ftl +++ b/core/src/main/resources/template/simple/script.ftl @@ -18,12 +18,10 @@ * under the License. */ --> + + <#assign temporaryVariable = stack.setValue("#optiontransferselect_js_included", "true") /><#t/> <#t/>
diff --git a/core/src/main/resources/template/xhtml/form-close-validate.ftl b/core/src/main/resources/template/xhtml/form-close-validate.ftl index 2cbb174f3..7fc151074 100644 --- a/core/src/main/resources/template/xhtml/form-close-validate.ftl +++ b/core/src/main/resources/template/xhtml/form-close-validate.ftl @@ -32,7 +32,9 @@ Only the following validators are supported: END SNIPPET: supported-validators --> <#if ((parameters.validate!false == true) && (parameters.performValidation!false == true))> - + <#if parameters.onsubmit??> ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return validateForm_${parameters.id?replace('[^a-zA-Z0-9_]', '_', 'r')}();")} <#else> diff --git a/core/src/main/resources/template/xhtml/head.ftl b/core/src/main/resources/template/xhtml/head.ftl index 8bd9f55ec..61a77831a 100644 --- a/core/src/main/resources/template/xhtml/head.ftl +++ b/core/src/main/resources/template/xhtml/head.ftl @@ -18,5 +18,7 @@ * under the License. */ --> - + +/> <#include "/${parameters.templateDir}/simple/head.ftl" /> diff --git a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java index 9317397d2..3e8547e6e 100644 --- a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java +++ b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java @@ -30,6 +30,7 @@ import org.springframework.mock.web.MockHttpServletResponse; import java.util.Collections; +import java.util.HashMap; import java.util.Map; public class UIBeanTest extends StrutsInternalTestCase { @@ -305,4 +306,20 @@ public class UIBeanTest extends StrutsInternalTestCase { assertEquals(cssStyle, txtFld.getParameters().get("cssStyle")); } + + public void testNonce() { + String nonceVal = "r4nd0m"; + ValueStack stack = ActionContext.getContext().getValueStack(); + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ActionContext actionContext = stack.getActionContext(); + Map session = new HashMap<>(); + session.put("nonce", nonceVal); + actionContext.withSession(session); + + DoubleSelect dblSelect = new DoubleSelect(stack, req, res); + dblSelect.evaluateParams(); + + assertEquals(nonceVal, dblSelect.getParameters().get("nonce")); + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java index f7ef72a42..a3f50278b 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java @@ -73,6 +73,8 @@ public class ComboBoxTest extends AbstractUITagTest { tag.setId("cb"); tag.setList("collection"); + stack.getActionContext().getSession().put("nonce", "r4nd0m"); + tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DebugTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DebugTagTest.java index bbee23b50..fa4729555 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DebugTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DebugTagTest.java @@ -48,10 +48,13 @@ public class DebugTagTest extends AbstractUITagTest { public void testDevModeEnabled() throws Exception { setDevMode(true); + stack.getActionContext().getSession().put("nonce", "r4nd0m"); tag.doStartTag(); tag.doEndTag(); String result = writer.toString(); + + assertTrue("Nonce value not included", result.contains("nonce=\"r4nd0m\"")); assertTrue(StringUtils.isNotEmpty(result)); assertTrue("Property 'checkStackProperty' should be in Debug Tag output", StringUtils.contains(result, "")); } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java index ff1a7d710..536a5d996 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java @@ -87,13 +87,15 @@ public class DoubleSelectTest extends AbstractUITagTest { tag.setCssStyle("s1"); tag.setDoubleCssClass("c2"); tag.setDoubleCssStyle("s2"); - + + stack.getActionContext().getSession().put("nonce", "r4nd0m"); + tag.doStartTag(); tag.doEndTag(); verify(SelectTag.class.getResource("DoubleSelect-1.txt")); } - + public void testOnchange() throws Exception { TestAction testAction = (TestAction) action; @@ -151,7 +153,7 @@ public class DoubleSelectTest extends AbstractUITagTest { tag.setCssStyle("s1"); tag.setDoubleCssClass("c2"); tag.setDoubleCssStyle("s2"); - + tag.doStartTag(); tag.doEndTag(); @@ -221,7 +223,7 @@ public class DoubleSelectTest extends AbstractUITagTest { } - + public void testDoubleWithDotName() throws Exception { TestAction testAction = (TestAction) action; @@ -377,4 +379,4 @@ public class DoubleSelectTest extends AbstractUITagTest { return key; } } -} +} \ No newline at end of file diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java index 535e42f31..1ccbb891d 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java @@ -61,6 +61,9 @@ public class FormTagTest extends AbstractUITagTest { tag.setEnctype("myEncType"); tag.setTitle("mytitle"); tag.setOnsubmit("submitMe()"); + + stack.getActionContext().getSession().put("nonce", "r4nd0m"); + tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java index a290f501a..a0c0ff296 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java @@ -32,7 +32,9 @@ public class HeadTagTest extends AbstractUITagTest { public void testHead1() throws Exception { HeadTag tag = new HeadTag(); tag.setPageContext(pageContext); - + + stack.getActionContext().getSession().put("nonce", "r4nd0m"); + tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java index f2de3c0d7..ee60cd80e 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java @@ -42,6 +42,7 @@ public class InputTransferSelectTagTest extends AbstractUITagTest { tag.setName("collection"); tag.setList("collection"); + stack.getActionContext().getSession().put("nonce", "r4nd0m"); tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java index 56b7b788a..d7e8bb1aa 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java @@ -85,6 +85,8 @@ public class OptionTransferSelectTagTest extends AbstractUITagTest { tag.setDoubleHeaderKey("Double Header Key"); tag.setDoubleHeaderValue("Double Header Value"); + stack.getActionContext().getSession().put("nonce", "r4nd0m"); + tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java index e0203728d..f35fa18f1 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java @@ -60,6 +60,8 @@ public class UpDownSelectTagTest extends AbstractUITagTest { tag.setValue("mySelectedMapIds"); tag.setEmptyOption("false"); + stack.getActionContext().getSession().put("nonce", "r4nd0m"); + tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt index fc3c1c0a8..0121ef451 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt @@ -1,7 +1,7 @@
checkStackProperty
- \ No newline at end of file + + \ No newline at end of file diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-1.txt index 22062bf7f..a73b85a28 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-1.txt @@ -1,7 +1,7 @@
- +
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-1.txt index d423b3a3c..2ee370596 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-1.txt @@ -1,7 +1,7 @@
- +
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/updownselecttag-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/updownselecttag-2.txt index a00d29403..0f8944b8b 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/updownselecttag-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/updownselecttag-2.txt @@ -1,5 +1,5 @@
- +