• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

please any one cleare my error

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the error message you are facing?
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@suresh

Hi suresh can you specify the error....???
 
Let's get him boys! We'll make him read this tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic