You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2012/12/05 11:02:58 UTC

[jira] [Commented] (WW-3825) Struts2 (modeldriven) update method setting fields which do not exist on form to null

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

Lukasz Lenart commented on WW-3825:
-----------------------------------

As Dave mentioned that's how the framework works. It will create an instance of Model with default constructor. If you want to avoid that, load your model from backend with Preparable interface, then only fields presented in request (from form) will be changed.
                
> Struts2 (modeldriven) update method setting fields which do not exist on form to null
> -------------------------------------------------------------------------------------
>
>                 Key: WW-3825
>                 URL: https://issues.apache.org/jira/browse/WW-3825
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.3.1.2
>            Reporter: Sam
>            Priority: Critical
>             Fix For: 2.3.8
>
>
> Struts 2 sets the fields values to Null, if it doesn't exists on view/jsp.
> See below link.
> http://forums.devshed.com/java-help-9/struts2-modeldriven-update-method-setting-fields-which-do-not-exist-642900.html
> I am forced to put all non view fields as HIDDEN on JSP page, to have it values transferred.
> Is there a way to retain the values of non form fields without using HIDDEN.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira