help on datatable

Hi guys,

i've a simple help to ask you.

I'm working on datatables and i've read balusC article,that i think is fantastic.

I've an only problem,that is the edit mode of a datatable's row.

In the article there is the saveMyTable() method that i'm not able to complete!

This is my loadUsers() (loadMyTable() in the article)

publicvoid loadUsers()throws Exception{

Context ctx =new InitialContext();

if (ctx ==null){

thrownew Exception("Boom - No Context");

}

Context envCtx = (Context) ctx.lookup("java:comp/env");

DataSource ds = (DataSource) ctx.lookup("java:comp/env/MysqlJNDI");// "java:comp/env/jdbc/nomedb"

Connection conn = ds.getConnection();

Statement stm = conn.createStatement();

ResultSet rst = stm.executeQuery("select * from user order by username");

List users =new ArrayList();

while (rst.next()){

User myUser =new User();

myUser.setFirstName(rst.getString("firstname"));

myUser.setLastName(rst.getString("lastname"));

myUser.setCity(rst.getString("city"));

myUser.setPassword(rst.getString("password"));

myUser.setLogin(rst.getString("username"));

myUser.setTeamname(rst.getString("teamname"));

myUser.setRole(rst.getString("type"));

myUser.setDate(rst.getString("birthdate"));

myUser.setAddress(rst.getString("address"));

myUser.setProfession(rst.getString("profession"));

myUser.setEmail(rst.getString("email"));

users.add(myUser);

}

setUsers(users);

}

How can i save my modifies in the selected row?

I use JDBC,not Hibernate....thanks for your help

[2629 byte] By [giubata] at [2007-10-3 2:37:35]
# 1
You are meaning this? http://balusc.xs4all.nl/srv/dev-jep-dat.html#SaveEditedDataItemI don't understand your problem? Just retrieve the edited object back using getMyTableItem() and then do your save DAO thing.
BalusCa at 2007-7-14 19:35:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
i've not understood how have i do my save things!!!Can you help me?
giubata at 2007-7-14 19:35:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
What's exactly the problem? Show some code where you're trying to do the save thing, then we prolly can help you better.
BalusCa at 2007-7-14 19:35:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

excuse my inexperience....

suppose i've 3 forms name,lastname city and i've modified the first two......

i've to save my modifies...how can i do?

can you help me with code?

I know how do it with a form, wrapping the value and updating the table but i've not understood how do it with datatable.....please help me with code...

giubata at 2007-7-14 19:35:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
It's nothing more than retrieving the edited object, preparing a SQL UPDATE statement and executing it. It's almost the same as loading the table using SQL SELECT statement, but then in reversed way.
BalusCa at 2007-7-14 19:35:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...