struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Schröder" <>
Subject Re: [S2] Does struts set null values for pojo fields?
Date Thu, 21 Aug 2008 08:09:39 GMT
I think you cann't expect Struts 2 to automatically remove an object just because one of it's
properties is set to null. Ok, in your case it's the id-property but struts 2 (or better OGNL)
doesn't know that.
So i don't think this is worth a feature request.
But here is the workaround i'd use:
use the prepare-Interceptor after params and set group to null if the ID is null in the prepare
method. That way the execute method stays a simple "persist( user );return SUCCESS;".


> <s:select label="Group" headerKey=""
> headerValue="-- None --"
> name=""
> value="%{}"
> list="%{#groupAction.list}"
> listKey="id" listValue="name"
> />
> Does anyone know if this can be done? Can I configure struts to set
> as null rather than create an empty Group object if no
> id/value has been specified in the drop down select box?
> Is this something that is working as desired, and I'm the one who needs
> to change? Or does struts maybe needs a new feature request in jira?
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message