Skip to Content
0
Jan 21, 2008 at 01:28 PM

Data not pipulating into table

18 Views

Hi sdns,

i have dreated 2 classes:- 1)main

2)sub

<h5>code of main:-</h5>

public class main {

Collection plist = new ArrayList();

Connection conn = null;

Statement st;

public void get_details()

{

try

{

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

conn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://10.10.30.25:1433;databaseName=TrackingSystem","sa","sa" ) ;

st = conn.createStatement();

String str = "select * from [Project Table]";

ResultSet rs = st.executeQuery(str);

String a = rs.getString(1);

String b = rs.getString(2);

String c = rs.getString(3);

while(rs.next())

{

pdetails rec = new pdetails();

rec.setEname(a);

rec.setRname(b);

rec.setDid(c);

plist.add(rec);

}

}

catch(Exception e)

{

}

}

public Collection getPlist() {

return plist;

}

public void setPlist(Collection collection) {

plist = collection;

}

}

<h3>code of pdetails</h3>

public class pdetails {

private String Ename;

private String Rname;

private String Did;

public pdetails()

{

Ename = new String();

Rname = new String();

Did = new String();

}

public pdetails(String Ename,String Rname,String Did)

{

this.Ename = Ename;

this.Rname = Rname;

this.Did = Did;

}

public String getDid() {

return Did;

}

public String getEname() {

return Ename;

}

public String getRname() {

return Rname;

}

public void setDid(String string) {

Did = string;

}

public void setEname(String string) {

Ename = string;

}

public void setRname(String string) {

Rname = string;

}

}

I have created a jar file for this classes And imported as a model in my web Dynpro Application.

And mapped it to component controller.

And from there to view controller.

I had a view with a table .

I created the table by using template of table.

And Binded it to the context of the view.

And the code i have written in the WDDOINIT() method is:-

IWDMessageManager msg = wdComponentAPI.getMessageManager();

try

{

Collection c;

c= new ArrayList();

main m = new main();

m.get_details();

c = m.getPlist();

wdContext.nodePdetails().bind(c);

wdContext.nodePdetails().invalidate();

}

}

catch (Exception e) {

// TODO: handle exception

msg.reportWarning("Sorry");

}

But data is not getting populated in my table.Anything i have to add to my code.

Or else have i done anything wrong in my code

Please help me in this Regard.