myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: JSF Value-Binding to Model Object doesnt work
Date Mon, 21 Apr 2008 04:01:41 GMT
See my reply on the facelets list. You should not be referencing the
request context to get a managed bean instance. Either use a managed
property, or build an EL expression (or binding for 1.1) and obtain it
that way.

Beans are lazy loaded and thus should be obtained through the proper API.

If you are using facelets, why is there a f:view in your code and why
are you not using ui:composition to make sure you do not have 2 BODY
tags?

On Sun, Apr 20, 2008 at 6:59 PM, bansi <mail2bansi@yahoo.com> wrote:
>
>  I also tried injecting FqdnBean into DeviceBean and then access model object
>  of FqdnBean i.e. Fqdn into DeviceBean as
>  Fqdn fqdnVO = fqdnBean.getFqdn();
>  Result:
>  It returns null
>
>
>
>
>
>  bansi wrote:
>  >
>  > Here is the code sample
>  >
>  > <html>
>  >
>  > <body>
>  >
>  > <f:view>
>  >
>  > <h:form id="updateDeviceForm">
>  >
>  > <h:panelGrid>
>  >
>  > ..........
>  >
>  > ..........
>  >
>  > <h:inputText id="deviceName" value="#{deviceBean.name}" style="width:
>  > 230px"
>  >
>  > styleClass="required max-63" >
>  >
>  >
>  > </h:panelGrid>
>  >
>  >
>  >
>  > <h:panelGrid>
>  >
>  > <ui:include src="fqdnForm.xhtml"></ui:include>
>  >
>  > </h:panelGrid>
>  >
>  > </f:view>
>  >
>  > </body>
>  >
>  > </html>
>  >
>  >
>  >
>  > Here is the snippet of fqdnForm.xhmtl which has value binding of name form
>  > field to model object Fqdn
>  >
>  >
>  >
>  > <body>
>  >
>  > <h:panelGrid columns="3" styleClass="detail" columnClasses="label">
>  >
>  > <h:inputText id="hostName" value="#{fqdnBean.fqdn. name}" style="width:
>  > 230px"
>  >
>  > styleClass="required max-63" >
>  >
>  > </h:inputText>
>  >
>  > <h:inputHidden id="fqdnHidden" value="#{fqdnBean.fqdn}"
>  > converter="#{fqdnConverter}"></h:inputHidden>
>  >
>  > </h:panelGrid>
>  >
>  > </body>
>  >
>  >
>  > The problem is i am unable to access model object fqdn in deviceBean and
>  > ofcourse quite obviously i am able to successfully access Fqdn model
>  > object in FqdnBean.
>  >
>  > But as fqdnForm is included in deviceForm i am accessing Fqdn model object
>  > or FqdnBean in  deviceBean as follows and it returns NULL
>  > 1)
>  >
>  > FqdnBean fqdnBean = (FqdnBean)
>  > FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("fqdnBean");
>  >
>  > 2)UIInput fqdnComp = (UIInput) FacesUtils.findComponentById(null,
>  > "fqdnHidden");
>  >
>  >
>  > Any pointers/suggestions will be highly appreciated
>  >
>
>  --
>  View this message in context: http://www.nabble.com/JSF-Value-Binding-to-Model-Object-doesnt-work-tp16785936p16800996.html
>
>
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message