You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Michael.Hintenaus@silbergrau.com (JIRA)" <ji...@apache.org> on 2017/04/21 14:55:04 UTC
[jira] [Updated] (WW-4788) Parameters which are added via
ServletDispatcherResult aren't availabe in #parameters
[ https://issues.apache.org/jira/browse/WW-4788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael.Hintenaus@silbergrau.com updated WW-4788:
-------------------------------------------------
Access to Parameter test will work, but access to Parameter foo will not
work
[ https://issues.apache.org/jira/browse/WW-4788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15978792#comment-15978792 ]
unittest)
(ServletActionContext.getRequest()).findValue("#parameters.test[0]");
in #parameters
-------------------------------------------------------------------------------------
(example: #parameters.foo)
request parameters
DISPATCHER, location = "index.jsp?foo=bar"))
ServletException {
("#parameters.test[0]"));
("#parameters.foo[0]"));
> Parameters which are added via ServletDispatcherResult aren't availabe in #parameters
> -------------------------------------------------------------------------------------
>
> Key: WW-4788
> URL: https://issues.apache.org/jira/browse/WW-4788
> Project: Struts 2
> Issue Type: Bug
> Components: Core Results, Value Stack
> Affects Versions: 2.5.10
> Reporter: Michael Hintenaus
> Fix For: 2.5.next
>
>
> before Version 2.5.5 the parameters were accessible via #parameters (example: #parameters.foo)
> now I won't get the parameters which are defined via location, only the request parameters
> I have an action like this
> {code:title=MyTest.java|borderStyle=solid}
> @Action(value = "execute", results = @Result(name = SUCCESS, type = DISPATCHER, location = "index.jsp?foo=bar"))
> public String execute() {
> return super.execute();
> }
> {code}
> and that's the TestCase
> {code:title=MyTest.java|borderStyle=solid}
> @Test
> public void testParameters() throws UnsupportedEncodingException, ServletException {
> request.addParameter("test", "me");
> executeAction("/test/dispatcher/execute.html");
> assertEquals("me", findValueAfterExecute("#parameters.test[0]"));
> assertEquals("bar", findValueAfterExecute("#parameters.foo[0]"));
> }
> {code}
> my current workaround:
> {code}
> #attr['com.opensymphony.xwork2.ActionContext.parameters'].foo
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)