-
1. managedproperty bean settings not shown on page load
ppitonak May 5, 2011 7:43 AM (in response to bcn)Hi,
do you use Mojarra or MyFaces?
Palo
-
2. Re: managedproperty bean settings not shown on page load
bcn May 5, 2011 7:53 AM (in response to ppitonak)Hm, not sure. I use JBoss 6 Final. Found this line on the startup:
10:35:38,144 INFO [JSFImplManagementDeployer] Initialized 3 JSF configurations: [Mojarra-1.2, MyFaces-2.0, Mojarra-2.0]
I program with RichFaces 4 Final. Does RichFaces use or need any of them internally?
I should add that the same happens if I refer to the locationBean with an h:outputLabel.
However, if in PostConstruct I set a field defined in the main bean, the corresponding content is shown on the page.
Thanks,
Ulrich
-
3. Re: managedproperty bean settings not shown on page load
ppitonak May 5, 2011 8:02 AM (in response to bcn)Hi,
yes, RichFaces adds some extra features to JSF so you need a JSF implementation (one of MyFaces or Mojarra). Since you're using JBoss 6, no confguration is needed from your side.
- Do you reference main bean in you page? The bean is not created until it's needed so your init() method won't be called.
- Can't you just set cityName in LocationBean's post-construct method?
Palo
-
4. Re: managedproperty bean settings not shown on page load
bcn May 5, 2011 9:08 AM (in response to ppitonak)1. yes I reference both beans on the page. I checked with the debugger that init() is called. If I add in init()
this.setAnotherProp("xxx")
(where this is the main bean), xxx is shown on the page!
2. Well, locationBean is a helper bean with proper xhtml page used by includes in several pages, so it is not aware of being used in the main bean. The helper bean is injected in the main bean, not the other way round. This way I want to achieve a modular, reusable design both with xhtml fragments and corresponding backing beans.
Thanks
-
5. Re: managedproperty bean settings not shown on page load
bcn May 5, 2011 1:12 PM (in response to bcn)So, I don't know why it doesn't work, but finally I have found a way.
In the main page do:
<ui:include src="/templates/location.xhtml" >
<ui:param name="bean" value="#{searchEstabRequestBean}" />
</ui:include>
and in the included page use:
<rich:autocomplete id="cityName" minChars="3" mode="ajax"
value="#{bean.locationBean.cityName}" autocompleteMethod="#{locationBean.suggestCities}"
selectFirst="false" >
<rich:validator />
</rich:autocomplete>
-
6. managedproperty bean settings not shown on page load
bcn May 6, 2011 4:30 AM (in response to bcn)Strange is the following: with
autocompleteMethod="#{bean.locationBean.suggestCities}
I get
10:22:11,935 GRAVE [org.richfaces.log.Renderkit] Objetivo inalcanzable, identificador 'bean' resuelto a nulo: javax.el.PropertyNotFoundException: Objetivo inalcanzable, identificador 'bean' resuelto a nulo
at org.apache.el.parser.AstValue.getTarget(AstValue.java:75) [:6.0.0.Final]
at org.apache.el.parser.AstValue.invoke(AstValue.java:183) [:6.0.0.Final]
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [:6.0.0.Final]
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43) [:6.0.0.Final]
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56) [:6.0.0.Final]
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43) [:6.0.0.Final]
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56) [:6.0.0.Final]
at org.richfaces.renderkit.AutocompleteRendererBase.getItems(AutocompleteRendererBase.java:105) [:4.0.0-SNAPSHOT]
at org.richfaces.renderkit.AutocompleteRendererBase.encodeItems(AutocompleteRendererBase.java:160) [:4.0.0-SNAPSHOT]
at org.richfaces.renderkit.AutocompleteRendererBase.encodeMetaComponent(AutocompleteRendererBase.java:271) [:4.0.0-SNAPSHOT]
It means identifier bean is null.
Could be a bug. But as it works as expected in the version above, I don't mind so much.