Trouble updating the database
Hi,
I using java studio creator 2 update 1. I have two pages. The first page contains a table with hyperlinks in serial_no column. When the user clicks on a hyperlink(serial_no) it redirects to another page which displays the details of the product that can be edited as drop down lists and text areas. I am not able to update the database with the edited values. I have been struggling with this since a week. Please help me. The code in the second page is as follows
public void prerender() {
serialNo = (String)getExternalContext().getRequestParameterMap().get("SerialNo");
try
{
getSessionBean1().getTblSampleRowSet4().setCommand("select Username, Problem_Type, Priority , Enhancement, Time, Source_req, Assigned_To,substring_index(Comment,'<END>',-1) as 'userComment', Solution, serial_no from tblSample where serial_no = " + serialNo);
stUserName.setText(getSessionBean1().getTblSampleRowSet4().getString("Username" ));
ddlProblemType.setSelected(getSessionBean1().getTblSampleRowSet4().getString("P roblem_Type"));
String priority = getSessionBean1().getTblSampeRowSet4().getString("Priority");
outputText1.setValue(priority);
ddlPriority.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Prio rity"));
// ddlp.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Priority")) ;
ddlEnhancement.setSelected(getSessionBean1().getTblSampleRowSet4().getString("E nhancement"));
ddlTime.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Time"));
ddlSourceReq.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Sou rce_req"));
ddlAssignedTo.setSelected(getSessionBean1().getTblSampleRowSet4().getString("As signed_To"));
taSolution.setText(getSessionBean1().getTblSampleRowSet4().getString("Solution" ));
taUserComment.setText(getSessionBean1().getTblSampleRowSet4().getString("userCo mment"));
}
catch(Exception e)
{
}
//}
}
}
/**
*
Callback method that is called after rendering is completed for
* this request, if <code>init()</code> was called (regardless of whether
* or not this was the page that was actually rendered). Customize this
* method to release resources acquired in the <code>init()</code>,
* <code>preprocess()</code>, or <code>prerender()</code> methods (or
* acquired during execution of an event handler).
*/
public void destroy() {
tblSampleDataProvider4.close();
// tblSampleDataProvider.close();
}
public String btnSave_action() {
// TODO: Process the button click action. Return value is a navigation
// case name where null will return to the same page.
try {
tblSampleDataProvider4.setValue("tblSample.Problem_Type", ddlProblemType.getSelected());
tblSampleDataProvider4.setValue("tblSample.Priority", ddlPriority.getSelected());
tblSampleDataProvider4.setValue("tblSample.Enhancement", ddlEnhancement.getSelected());
tblSampleDataProvider4.setValue("tblSample.Time", ddlTime.getSelected());
tblSampleDataProvider4.setValue("tblSample.Source_req", ddlSourceReq.getSelected());
tblSampleDataProvider4.setValue("tblSample.Assigned_To",ddlAssignedTo.getSelect ed());
tblSampleDataProvider4.setValue("tblSample.Comment",taUserComment.getText());
tblSampleDataProvider4.setValue("tblSample.Solution", taSolution.getText());
tblSampleDataProvider4.commitChanges();
tblSampleDataProvider4.refresh();
} catch (Exception ex) {
outputText1.setValue("error");
}
return null;
}
If i use
getSessionBean1().getTblSampleRowSet4().execute(); after setting the command, it doesnt work. But if i comment it out, data corresponding to the serial no passes gets displayed. But I am not able to update the table with edited data.
S

