On 1/13/07, JS Portal support team <[EMAIL PROTECTED]> wrote:
Hi, I have a view (myfiles.jsp) plus backing bean (myfiles). myfiles.jsp has an jsp:include (filestable.jsp) in an s:subview which is backed by my generictable bean. How can I best pass the List of file Objects from myfiles to generictable. Something like <jsp:param name="fileList" value="#{myfiles.files}"> would be great. Or is this not the right way to setup my architecture?
As a matter of fact, something very similar to this is available ... but it's done in the managed bean definition instead of in the view: <managed-bean> <managed-bean-name>generictable</managed-bean-name> <managed-bean-class>...</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>fileList</property-name> <value>#{myfiles.files}</value> </managed-property> </managed-bean> The expression will be evaluated when this managed bean is created, and setFileList() will be called with the result. This general technique is known as dependency injection, and JSF supports the variant called "setter injection" which (as the name implies) uses property setters to actually insert the values. The only restriction on what kind of expressions you can evaluate are that you cannot inject a value from a shorter scope (such as request) into a bean in a longer scope (session or application). The other way around (longer-scoped bean into shorter-scoped bean property), or the same scope, is fine. Thank you
Craig