1. First, we have to write one new method in AMImpl class fro creating new record
public void InsertRecord()
{
InsertVOImpl vo= getInsertVO1();
OADBTransaction trans= getOADBTransaction();
vo.executeQuery();
Row v_row;
v_row = (Row)vo.createRow();
vo.insertRow(v_row);
}
2. In controller, we have to initialise the AM in processRequest
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
am.InsertRecord(); /* Name of the method which we created in AM */
}
3. In processFormRequest, we have to write code for save the record into database.
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("item6")!=null)
{
am.getOADBTransaction().commit();
throw new OAException("Employee Created sucsessfully",OAException.CONFIRMATION);
}
}
public void InsertRecord()
{
InsertVOImpl vo= getInsertVO1();
OADBTransaction trans= getOADBTransaction();
vo.executeQuery();
Row v_row;
v_row = (Row)vo.createRow();
vo.insertRow(v_row);
}
2. In controller, we have to initialise the AM in processRequest
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
am.InsertRecord(); /* Name of the method which we created in AM */
}
3. In processFormRequest, we have to write code for save the record into database.
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("item6")!=null)
{
am.getOADBTransaction().commit();
throw new OAException("Employee Created sucsessfully",OAException.CONFIRMATION);
}
}
No comments:
Post a Comment