Hi All,
I am tring to insert values into database,
Here is my code, can any one tell me what is the problem?
My bean code is
public class GroupCodes
{
Connection con;
private String cgt_code_group_type_cd;
private String cgt_code_group_desc;
private String ct_code_type_cd;
private String ct_code_group_type_cd;
private String ct_code_type_desc;
String p;
String q;
/**
* Constructor
*/
public GroupCodes()
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@172.16.64.183:1521:EURODB
1","oper","oper");
}
catch (ClassNotFoundException e)
{
System.out.println("Class not foune " + e);
}
catch (SQLException e)
{
System.out.println("Sql Exception occured " + e);
}
}
public void set_cgt_code_group_type_cd(String cgt_code_group_type_cd)
{
this.cgt_code_group_type_cd = cgt_code_group_type_cd;
}
public String get_cgt_code_group_type_cd()
{
return cgt_code_group_type_cd;
}
public void set_cgt_code_group_desc(String cgt_code_group_desc)
{
this.cgt_code_group_desc = cgt_code_group_desc;
}
public String get_cgt_code_group_desc()
{
return cgt_code_group_desc;
}
public void add_Glb_Cgt()
{
try
{
CallableStatement pstmt = con.prepareCall("{call
GLB_CODE_PKG.ins_glb_code_group_type_proc(?,?)}");
pstmt.setString(1,cgt_code_group_type_cd);
pstmt.setString(2,cgt_code_group_desc);
pstmt.execute();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
Here is the code from jsp file, this come last in the jsp file, first part
is accepting the values
<jsp:useBean id="GroupCodeType" scope="page" class="Util.GroupCodes" />
<jsp:setProperty name="GroupCodeType" property="*" />
<html>
<head>
<title>Validation Group</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#E0E0E0">
<FORM NAME="InsCodeGroup" onSubmit="return validate_form()" METHOD="GET">
<CENTER>
<tr>
<td COLSPAN=2 ALIGN="CENTER" height="66"><A onMouseOver="a('Enter the
Validation Group Type');return true" onMouseOut="b()">Validation
Group</a>
<input type="text" name="cgt_code_group_type_cd" >
</td>
</tr>
<tr>
<td COLSPAN=2 ALIGN="CENTER" height="63"><A onMouseOver="a('Enter the
Validation Group Description');return true" onMouseOut="b()">Validation
Group Description</a>
<input type="text" name="cgt_code_group_desc" >
</td>
</tr>
<tr>
<td COLSPAN=2 ALIGN="CENTER" height="63">
<input type="submit" name="save" value="save">
</td>
</tr>
</table>
</CENTER>
</FORM>
<% if(request.getParameter("save") != null) {%>
//<%GroupCodeType.set_cgt_code_group_type_cd(request.getParameter(cgt_code_g
roup_type_cd)); %>
//<%GroupCodeType.set_cgt_code_group_desc(request.getParameter(cgt_code_grou
p_desc)); %>
<% GroupCodeType.add_Glb_Cgt(request); %>
<% }
else if (request.getParameter("delete") != null) { %>
<%GroupCodeType.add_Glb_Cgt(); %>
<% } %>
</body>
</html>
MY stored procedure work fine.
It is inserting second column into the first column, and
cgt_code_group_type_cd is primary key in the table.
Any suggestion will be of great help.
Bye
Srikanth
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets