Struts 2 submit form to one object
I have something similar to that:

     class Model {
    	private String field1;
    	private String field2;
    	
    	//setters
     }

    class Action extends ActionSupport {
        private Model model;
        public String execute() {
            //breakpoint
        }
        public void setModel(Model model){
            this.model=model;
        }
    }

on jsp:

    <s:form id="addCommentForm" method="POST" namespace="%{namespace}" action="addComment">
        <input type="text" name="model.field1"/>
        <input type="text" name="model.field2"/>
    </s:form>

When I submit this form unfortunately only 1 field in Model class is set.
I debug code and find that actually setters are called for both fields (field1 and field2), but for different instances of Model class.

So it appears, that it executes with next steps when form is submitteed:

 1. create new instance (instance1) of Model class, set this instance in Action class
 2. set field1 to instance1
 3. create new instance (instance2) of Model class, set this instance in Action class
 4. set field2 to instance2

So as I see instanse2 replace instance1.
I need field1 and field2 in one instance of Model class. 
What need to be modified? 
Struts 2 submit form to one object
===

I have something similar to that:

     class Model {
    	private String field1;
    	private String field2;
    	
    	//setters
     }

    class Action extends ActionSupport {
        private Model model;
        public String execute() {
            //breakpoint
        }
        public void setModel(Model model){
            this.model=model;
        }
    }

on jsp:

    <s:form id="addCommentForm" method="POST" namespace="%{namespace}" action="addComment">
        <input type="text" name="model.field1"/>
        <input type="text" name="model.field2"/>
    </s:form>

When I submit this form unfortunately only 1 field in Model class is set.
I debug code and find that actually setters are called for both fields (field1 and field2), but for different instances of Model class.

So it appears, that it executes with next steps when form is submitteed:

 1. create new instance (instance1) of Model class, set this instance in Action class
 2. set field1 to instance1
 3. create new instance (instance2) of Model class, set this instance in Action class
 4. set field2 to instance2

So as I see instanse2 replace instance1.
I need field1 and field2 in one instance of Model class. 
What need to be modified? 