dcsimg
Retrieving data from a nested datatable's row...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Giuseppe_Battinelli
Posted On:   Wednesday, September 13, 2006 06:02 PM

Hi guys, i've a question for you for a problem that i have from 10 day and i'm trying to solve it but nothing....please help me. I'm using 2 nested datatables as described in BalusC article. I need using them for input fields,so i have a command button at the end of each row. My jsp page is value="#{biosamplesTable.outerList}" var="outerItem" binding="#{biosamplesTable.outerDataTable}" cellpadding="5" border="3" cellspacing="5"> value="#{biosamplesTable.innerList}" var="innerItem" >    More>>

Hi guys,
i've a question for you for a problem that i have from 10 day and i'm trying to solve it but nothing....please help me.
I'm using 2 nested datatables as described in BalusC article.
I need using them for input fields,so i have a command button at the end of each row.
My jsp page is

			


value="#{biosamplesTable.outerList}"
var="outerItem"
binding="#{biosamplesTable.outerDataTable}"
cellpadding="5" border="3" cellspacing="5">










value="#{biosamplesTable.innerList}"
var="innerItem"
>


















>


and i've one InnerListMap that maps the index of outerList with the right innerList.
My problem is that i'm not able to pass the values inserted from user to innerList,that have ever null values,while outerList go well.
This is my loadInnerListMap
			

public void loadInnerListMap() {
for (Iterator iter = outerList.iterator(); iter.hasNext();) {
MyData outerItem = (MyData) iter.next();
List innerList = new ArrayList();
MyData2 mydata=new MyData2();
mydata.setNam("italy");
mydata.setValor("naples");
innerList.add(mydata);
innerList.add(new MyData2());
innerList.add(new MyData2());
innerListMap.put(outerItem.getId(), innerList);
}
}




with this code i set the value for the first row of each innerlist and it goes well...for the second and third row i pass null values and i'm not able to pass user'values.
This is my send action
			


public void send(ActionEvent e) throws Exception{
System.out.println("Il numero di lista passatoè "+ident);
List innerListNew = (List) innerListMap.get(((MyData) outerDataTable.getRowData()).getId());

for (int i=0;i
System.out.println("Il nome dell'elemento è "+((MyData2) innerListNew.get(i)).getNam());
System.out.println("Il nome dell'valore è "+((MyData2) innerListNew.get(i)).getValor());
}

myDataItem = (MyData) getOuterDataTable().getRowData();
if (conn != null) {
PreparedStatement pst2 = null;
pst2 = conn.prepareStatement("INSERT INTO esterna(nome,valore) values(?,?)");

pst2.setString(1, myDataItem.getName());
pst2.setString(2, myDataItem.getValue());
pst2.executeUpdate();
}
}




with this send method i send correctly outerList values to db table.
Can someone help me passing the right values from user to innerList and from innerList to db table?
Please help me,i'm crazying and i need to go on....>    <<Less
About | Sitemap | Contact