Yes, you call FacesContext.getRequestBean(String) and pass in the name
of the var you gave to the dataTable. All UIData elements place that
variable in request scope when a component from a row broadcasts and
event.
On Tue, 16 Nov 2004 10:58:13 +0100, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> short: Can I get the model object of a row in a dataTable out of the event
> object in the ValueChangeListener method?
>
> long:
> I try to do something with the ValueChangeEvent. My itension is like this:
> I have an order screen, where the user types in different values of an
> order.
> The main part is a dataTable with SKU Lines(item lines). Now the user wants
> to type in the sku number and the application should fetch all the
> data(description,
> price,vat) from the database by it self.
> So I added a ValueChangeListener to my InputText Field. I get into the
> method but
> I don't know how to get the model object of my sku line. I tried with the
> ValueBindingMap
> but had no luck to find the right path....
>
> A workaround would be to make the ValueChangeListener on the skuline model
> object.
> Then I could reference the model easily with "this". But I don't like to
> have to JSF GUI Method
> on my generic skuline model object....
>
> Here are my classes:
>
> public class WVSForm <-------------- This is my BackingBean
> {
> private WVS a_WVSObject = null;
>
> public void skuChangeListener(javax.faces.event.ValueChangeEvent
> event)
> {
>
> Integer t_skunbr = (Integer)event.getNewValue();
>
> ValueBinding t_bind =
> event.getComponent().getValueBinding("value");
> String t_wvsSkuLineItemEL = t_bind.getExpressionString();
> Object t_source = event.getSource();
> Object t_skulineItem =
> FacesContext.getCurrentInstance().getApplication().getVariableResolver().resolveVariable(FacesContext.getCurrentInstance(),t_wvsSkuLineItemEL);
>
>
> System.out.println("");
>
> //GkSkuBroker.current().getFullSku(t_skunbr.toString(),"1",event.getSource())
> }
> }
>
> public class WVS <----------------------- This is my order model
> {
> private java.lang.Integer a_Rayon;
> private java.lang.Integer a_Company;
> private java.lang.String a_UserId;
> private java.lang.Integer a_Status;
> private java.util.Date a_CreateDate;
> private BigDecimal a_TotalCostAmount = new BigDecimal(0.00d);
> private java.util.List a_SkuLineItemList; //
> <------------------------------------- this is my List of skulines
> private Integer a_WvsNbr;
> private Integer a_SenderBranch;
> private Integer a_ReceiverBranch;
> }
>
> public class WVSSkuLineItem <------------------------ This is my skuline
> model
> {
>
> private java.lang.String a_Descriptionvendor;
> private java.lang.Integer a_Skunbr;
> private String a_SkuType = "1"; // TODO fix this with the skubroker
> private BigDecimal a_Costamount = new BigDecimal(new
> BigInteger("0"),2);
> private Integer a_Seqnbr;
> private BigDecimal a_Quantity = new BigDecimal(new
> BigInteger("0"),3);
> private BigDecimal a_Costprice = new BigDecimal(new
> BigInteger("0"),2);
> private BigDecimal a_Retailprice = new BigDecimal(new
> BigInteger("0"),2);
> private java.lang.String a_Description;
> private BigDecimal a_Retailamount = new BigDecimal(new
> BigInteger("0"),2);
> private WVS a_Header;
> private Integer a_Company;
> }
>
> And the JSP entry:
>
> <x:dataTable
> id="skuListTable"
> styleClass="InsideFieldSetSkuTable"
> style="border-collapse : collapse;"
> headerClass="BoldText"
> rowClasses="FormNormal"
> columnClasses="TableInputButton NormalText, FillerSmall,
> FieldFormMedium NormalText TextLeftAlign,Filler,FieldForm NormalText
> var="sku"
> value="#{WVSForm.a_WVSObject.a_SkuLineItemList}"
> >
>
> <h:column >
> <f:facet name="header">
> <h:outputText value="#{msg.WVS_sku_nbr}" />
> </f:facet>
> <x:message for="skunbr" detailFormat="*"
> styleClass="ErrorText" />
> <h:inputText id="skunbr" value="#{sku.a_Skunbr}"
> required="true" styleClass="FieldFormMedium NormalText TextLeftAlign"
> valueChangeListener="#{WVSForm.skuChangeListener}" >
> <f:validateLength minimum="8" maximum="8" />
> </h:inputText>
> </h:column>
> </x:dataTable>
>
>
> Thanks for reading this!
>
> Chris
>
--
If you don't have a GMail account, I probably have 5 invites. Just ask!
-Heath Borders-Wing
[EMAIL PROTECTED]