struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "COMBEAU (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4684) No set parameter value to action
Date Fri, 02 Sep 2016 09:55:20 GMT

    [ https://issues.apache.org/jira/browse/WW-4684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15458044#comment-15458044
] 

COMBEAU edited comment on WW-4684 at 9/2/16 9:54 AM:
-----------------------------------------------------

My JavaScript is like this :
{code:javascript}
var Segment = function(sgmt) {
            var _this = this;
            
            this.id = sgmt.id;
            this.name = sgmt.name;
            this.comment = sgmt.comment;
            this.display = sgmt.display;
            this.type = ko.observable(sgmt.type);
        };


var params = ko.mapping.toJSON({segments: _this.segments(), sendMail: _this.sendMail()});

                $.ajax({
                      url:'segmentsName/save.action',
                      type:"POST",
                      data:params,
                      contentType:"application/json; charset=utf-8",
                      dataType:"json",
                      success: function(data){
                             utils.loadingWidget.hide();
                             utils.notify(data.status, data.message, _this.load);
                      }
                });
{code}

And my Action contains :

{code:java}
private List<SegmentDTO> segments;
public List<SegmentDTO> getSegments() {
	return segments;
}

public void setSegments(List<SegmentDTO> segments) {
	this.segments = segments;
}
{code}
And my struts config file is in attachement


And the request header contains :
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate, br
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Length:1609
Content-Type:application/json; charset=UTF-8


was (Author: walkn):
My JavaScript is like this :
{code:javascript}
var Segment = function(sgmt) {
            var _this = this;
            
            this.id = sgmt.id;
            this.name = sgmt.name;
            this.comment = sgmt.comment;
            this.display = sgmt.display;
            this.type = ko.observable(sgmt.type);
        };


var params = ko.mapping.toJSON({segments: _this.segments(), sendMail: _this.sendMail()});

                $.ajax({
                      url:'segmentsName/save.action',
                      type:"POST",
                      data:params,
                      contentType:"application/json; charset=utf-8",
                      dataType:"json",
                      success: function(data){
                             utils.loadingWidget.hide();
                             utils.notify(data.status, data.message, _this.load);
                      }
                });
{code}

And my Action contains :

{code:java}
private List<SegmentDTO> segments;
public List<SegmentDTO> getSegments() {
	return segments;
}

public void setSegments(List<SegmentDTO> segments) {
	this.segments = segments;
}
{code}
And my struts config file is in attachement


> No set parameter value to action
> --------------------------------
>
>                 Key: WW-4684
>                 URL: https://issues.apache.org/jira/browse/WW-4684
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.5.2
>         Environment: Windows
>            Reporter: COMBEAU
>             Fix For: 2.5.3
>
>         Attachments: struts.xml
>
>
> I have an issue on my webapp since I have update Struts 2 to version 2.5.2 from 2.3.28.
> When I post a form with parameters via ajax call, on the action class setters are not
called. All the time the setter and getter return "null" value
> I used Struts2-core and struts2-json-plugin



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message