I am new to jsp and I am trying to make an apllication form in jsp which saves the details of the member in the mysql . Connectivity part is done it is taking in the details and saving them to mysql DB , issue is that few columns like pincode , mobile number & fax ,validation is not working with them .
Please suggest me how to add validation to these columns .
Also I am trying to save the image of the applicant but it takes the image as an attachment and when I try to fetch the data from DB it only shows the attachment not the image .
Manish kumarPosted Nov 29, 2016, 10:07 AM
2-2-11/11/2016-40-160
3-3-11/11/2016-30-190
<%@page import="java.sql.*"%>
<%@ page import="java.util.Calendar" %>
<%
//java Code 25/11/2016
try
{
String date = (new java.util.Date()).toString();
String OrderDate=request.getParameter("OrderDate");
int OrderID = Integer.parseInt(request.getParameter("OrderID"));
int Amount = Integer.parseInt(request.getParameter("Amount"));
int Running_Total=Integer.parseInt(request.getParameter("Running_Total"));
String sql_debit="select OrderID,OrderDate,Amount,(select sum(Amount) from CustomerOrders where OrderID <= OrderID)'Running_Total' from CustomerOrders";
String s="jdbc:odbc:Database2";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(s);
Statement pstmt=conn.createStatement();
Calendar calendar = Calendar.getInstance();
java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());
ResultSet result = pstmt.executeQuery(sql_debit);
//int count = 0;
while (result.next())
{
//result.getInt("Running_Total");
Running_Total = result.getInt(1);
//result.getInt(1);
String output = "User #%d: %s ";
System.out.println(String.format(output, Running_Total));
}
conn.close();
}
catch(Exception ex)
{
System.err.println(ex.getMessage());
}
%>