struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jimski <jimk...@gmail.com>
Subject Re: [S2] Beans list in Dynamic form and ParametersInterceptor problem
Date Tue, 22 Jan 2008 18:27:07 GMT

Hi totojack-

I think you're right that the key property is useless now that you're using
the positional index to access your list elements.  

Also, the type conversion page says that using the unique id indexed
approach won't allow for automatic creation of instances.  The docs say the
following: "Unlike Map and List element properties, if fooCollection(22)
does not exist, it will not be created. If you would like it created, use
the notation fooCollection.makeNew[index] where index is an integer 0, 1,
and so on."

I haven't been able to get makeNew to work and no one on the list responded
to a previous question on it so I'm assuming that the feature is deprecated
and the documentation is out of date.  Which is really a shame since
positional indexing of a list comes with some risks that accessing elements
by unique id does not.  You can write some hacks to get around this, but
they lack the elegance that a web framework that really understood
collections could have provided.



totojack wrote:
> 
> The problem of songs list size is solved using #stat.index. But not the
> parameters error.
> The list size now is 1, but the element inside is null.
> So, it can't create song beans and put it into the list.
> In the conversion props file the Element_songs is correctly set to the
> Song bean class.
> The KeyProperty is useless now using the iterator index? 
> 
> Here some logs:
> DEBUG (interceptor.ParametersInterceptor:148) - Setting params
> songs[1].endDate => [ 01.01.2099 ] [  ] songs[0].endDate => [ 01.01.2099 ]
> songs[0].statusLoad => [ Publish ] songs[0].statusSellable => [ 1 ] 
> songs[1].songId => [ 9121591 ] songs[1].statusLoad => [ Publish ]
> songs[1].statusSellable => [ 1 ] songs[0].songId => [ 9121587 ]
> songs[0].startDate => [ 29.11.2007 ] songs[1].startDate => [ 29.11.2007 ] 
> ERROR (interceptor.ParametersInterceptor:204) - ParametersInterceptor -
> [setParameters]: Unexpected Exception caught setting 'songs[0].endDate' on
> 'class it.telecomitalia.orchestrator.console.actions.ResubmitAction: Error
> setting expression 'songs[0].endDate' with value
> '[Ljava.lang.String;@16825b5'
> (...)
> 
> 
> Reading the manual at
> http://struts.apache.org/2.0.11/docs/type-conversion.html it says:
> "Notice the () notation! Do not use [] notation, which is for Maps only!"
> but changing the notation from 
> songs[%{#stat.index}].property
> to
> songs(%{#stat.index}).property
> in the jsp, the form isn't populated.
> 
> 

-- 
View this message in context: http://www.nabble.com/-S2--Beans-list-in-Dynamic-form-and-ParametersInterceptor-problem-tp15016850p15024812.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message