-
1. Re: Dropdown menu (h:selectOneMenu) cleared when button (h:commandButton) pressed
chris.simons Dec 15, 2008 6:49 PM (in response to bedek_bedkowski)Your not injecting
list
, so why would you expect it to be available again?You could also put an action parameter on your pages.xml for this particular page and set action="#{search.getList()}"
My point being that
list
is not on an entity and you're not outjecting or injectinglist
as an object. -
2. Re: Dropdown menu (h:selectOneMenu) cleared when button (h:commandButton) pressed
bedek_bedkowski Dec 15, 2008 8:27 PM (in response to bedek_bedkowski)Hi,
I think you're wrong - using @Factory in way as above is outjecting automaticly.
To be clear drop down list is rendered when I enter my page for a first time, then when I press
Search
button it is cleared (not populated and there is no exception thrown) and then when I click once againSearch
it is populated again and so on.Please take a look here http://chiralsoftware.com/jboss-seam-book/unwrap.seam, this document says:
The @Factory annotation can be used in two different ways:
- On a getter method, like this: @Factory public String getTimeString()
- On a method with a void return type, like this: @Factory(
componentName
) public void generateResult() in conjunction with an @Out annotation
Example which I gave above is related with first option.
I've also made few tests - take a look here: http://www.seamframework.org/Community/SelectItemsAndFactory
-
3. Re: Dropdown menu (h:selectOneMenu) cleared when button (h:commandButton) pressed
bedek_bedkowski Dec 16, 2008 11:38 AM (in response to bedek_bedkowski)Hi,
The problem was not related with Chris Simons comment about
not outjecting
variable back to page - this is not needed since @Factory with getter method returning value don't need additional @Out.Resolution:
In page code to generate list of options I've used Seam tag:
<s:selectItems value="#{list}"/>
while this is causing problems and to fix I've just changed to JSF tag:
<f:selectItems value="#{list}"/>
and all works fine.
The only thing is that I'm not sure why this is working but it sure is :)