aspose file tools*
The moose likes Servlets and the fly likes please any one cleare my error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "please any one cleare my error" Watch "please any one cleare my error" New topic
Author

please any one cleare my error

suresh kalaimani
Greenhorn

Joined: Aug 15, 2009
Posts: 1
JAVA CODING:
import java.io.*;
import java.sql.*;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;


public class Invoice extends HttpServlet {

protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException , IOException {

PrintWriter out = res.getWriter();

String partyname = req.getParameter("s1");
String ExporterName = req.getParameter("s2");
String Billno =req.getParameter("s3");
String invoiceno =req.getParameter("s5");
String certificate =req.getParameter("s7");
String cityportloading =req.getParameter("s9");
String cityportdischarge =req.getParameter("s10");

String Description =req.getParameter("s11");
//String particulars =req.getParameter("");
//String billingcharge =req.getParameter("");
String total =req.getParameter("s12");
String amount =req.getParameter("s13");
String amountchangeableinwords = req.getParameter("s14");
String Billnodated = req.getParameter("s4");
String invoicedated = req.getParameter("s6");
String certificatenodated = req.getParameter("s8");


try{
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/master","root","");
PreparedStatement ps = connection.prepareStatement("insert into invoice values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1,partyname);
ps.setString(2,ExporterName);
ps.setInt(3, Integer.parseInt(Billno));
ps.setInt(4, Integer.parseInt(invoiceno));
ps.setString(5,certificate);
ps.setString(6,cityportloading);
ps.setString(7,cityportloading);

ps.setString(8,Description);
//ps.setString(9,particulars);
//ps.setInt(10, Integer.parseInt(billingcharge));
ps.setInt(11, Integer.parseInt(total));
ps.setInt(12, Integer.parseInt(amount));
ps.setString(13,amountchangeableinwords);
ps.setInt(14, Integer.parseInt(Billnodated));
ps.setInt(15, Integer.parseInt(invoicedated));
ps.setInt(17, Integer.parseInt(certificatenodated));
int s = ps.executeUpdate();
if(s > 0){
out.println("<h2>Values inserted into table.....</h2>");
} else {
out.println("<h2>Not Inserted.....</h2>");
}

}catch (SQLException sqe) {
sqe.printStackTrace();
}catch (ClassNotFoundException cne) {
cne.printStackTrace();
}

}
}




JSP CODING:


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>



<Head>
<Title> Invoice </Title>
</Head>
<Body background="Back.jpg">
<form name="sample" action="invoice" method="post">
<table border="1" width="100%">
<tr>
<td><img src="C:/WebProject_workspace/My_FirstProject/WebContent/images/jj.jpg"></img></td> <td ><font color="blue" size="10"> INVOICE</font></td>
<Table align="left" border="1" cellspacing="10" cellpadding="10">
<tr>
<td> Party Name</td><td><input type="text" name="s1"></td>
</tr>
<tr>
<td> Exporter Name</td><td><input type="text" name="s2"></td>
</tr>
</table>
<table align="center" border="1">
<tr>
<td>Bill No:</td><td><input type="text" name="s3"></td><td>BillnoDated:</td><td><input type="text" name="s4"></td>
</tr>
<tr>
<td>Invoice No:</td><td><input type="text" name="s5"></td><td>InvoiceDated:</td><td><input type="text" name="s6"></td>
</tr>
<tr>
<td>Certificate:</td><td><input type="text" name="s7"></td><td>CertificateDated:</td><td><input type="text" name="s8"></td>
</tr>
<tr>
<td>City/Port Loading:</td><td><input type="text" name="s9"></td><td>City/Port Discharge:</td><td><input type="text" name="s10"></td>
</tr>
<tr>
<td>Description:</td><td><textarea name="s11 "></textarea></td>
</tr>
</table>
<table Border="1">
<tr> <td>
<table Border="1" align="left" width="400">
<tr>
<th>particulars</th>
</tr>
<tr>
<td>Billing Charge</td>
</tr>
<tr>
<td>Total</td><td>
</tr>
</table>
<table align="" border="1" width="150">
<tr>
<th>Amount</th>
</tr>
<tr>
<td><input type="text" name="s12"></td>
</tr>
<tr>
<td><input type="text" name="s13"></td>
</tr>

</table>
</td>
</tr>
</table>


<table Border="1">
<tr>
<td> Amount Changeable in Words:</td>
</tr>
<tr> <td><textarea name="s14"></textarea></td>
</tr>
</table>
<br><br><br>
<table Border="0" align="right">
<tr>
<td>For FUMITECT Services</td>
</tr>
<tr> <td>      </td>
</tr>
<tr> <td>Authorised Signatory</td>
</tr>
</table>

<input type="submit" name="n3" value="ok">
<input type="Reset" name="n3" value="cancel">

</body>


</html>





WEB.XML:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>My_FirstProject</display-name>


<servlet>
<servlet-name>SampleProgram</servlet-name>
<servlet-class>Invoice</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SampleProgram</servlet-name>
<url-pattern>/invoice</url-pattern>
</servlet-mapping>

</web-app>

K.SURESH
(SALEM,CHENNAI)
chandra kambham
Ranch Hand

Joined: Jun 09, 2008
Posts: 74
What is the error message you are facing?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

A couple of things:

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

And, please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

A title such as "please any one cleare my error" is not helpful. What would happen if all posts had such a title?

Please go back and change your post to add a more meaningful subject by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sai Kiran nukala
Greenhorn

Joined: Aug 16, 2009
Posts: 9
@suresh

Hi suresh can you specify the error....???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please any one cleare my error
 
Similar Threads
jsp insert program not working
The max input fields for servlet can handle
accessing jsp array variable in javascript
spaces while populating using s:iterator
JDBC code with type 1 driver not working