Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts shoping items billng source code
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


surya lakshmi
shoping items billng source code
1 Answer(s)      2 years and 2 months ago
Posted in : Struts


Hi, I am doing a project on invoice making, I am unable to make code for the billing, I have a n jsp page "invc.jsp", here in this page i need to get the items from the data base with respect to the item code, I am taking item code in a drop down list, and the item codes should be sorted by the most selected items order, I want to add two or more items for the billing, and the select items are added to the "bill.jsp" page with total amount to be payable,and the selected item quantity should be updated in the data base, so please help me in this,

<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>;
<script type="text/javascript>
    function generatenew(){
        document.abc.code1.style.visibility="visible";
        document.abc.type1.style.visibility="visible";
        document.abc.quantity1.style.visibility="visible";
    }
</script>
<%
    String data1 = request.getParameter("code1");
    String data2 = request.getParameter("type1");
    String data3 = request.getParameter("quantity1");
%>
   <form method="post" name='invcform' action="invoice.do">;
                    <table cellpadding='2' cellspacing='2' border="0" bgcolor="#E9E9E9" colspan="0" width="500" align="center"> 
                        <tr><td></td></tr>
                        <tr><td>Customer Name:</td><td><input type="text" name="name" value="" size=25></td>
                            <td>Number:</td><td><input type="text" name="no" value="" size=20></td></tr>;
                        <tr><td>Address</td><td><textarea rows="2" cols="20" name="add"></textarea></td></tr>
                        <tr><td><br></td></tr>
                        <tr><td>Item Code:</td><td><select name='code' onchange="showState(this.value)"><br>
      <option value="none">Select</option>

<option value="code"></option></select>  <input type="text" style="visibility:hidden" name="code1" size="10"></td></tr>
                    </table>

Advertisement
View Answers

September 10, 2012 at 4:40 PM


Here is a jsp application, where user is allowed to select the item code from the dropdown whose values have been retrieved from the database. On selecting particular item code, the name and price linked with that code will get displayed into the textboxes.

1)items.jsp:

<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<html>
<head>
<script type="text/javascript">
function showData(){ 
xmlHttp=GetXmlHttpObject()
    var code=document.getElementById("code").value;
var url="price.jsp";
url=url+"?code="+code;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
    }
function stateChanged(){ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 

  var showdata = xmlHttp.responseText; 
    var strar = showdata.split(":");
      if(strar.length>1)
         {
        var strname = strar[1];
        document.getElementById("name").value= strar[1];
        document.getElementById("price").value= strar[2];
         }

 } 
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{
  xmlHttp=new XMLHttpRequest();
 }
catch(e){
 try{
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch(e){
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
</head>
<body>
<select id='code' onchange="showData()">
<option value="none">Select</option>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from item");
while(rs.next()){
%>
<option value="<%=rs.getString("itemCode")%>"><%=rs.getString("itemCode")%></option>
<%
}
%>
</select>
<br>
<div id='item'>
<table>
<tr><td>Item Name:</td><td><input type="text" id="name" name="name"></td></tr>
<tr><td>Price:</td><td><input type="text" id="price" name="price"></td></tr>
</table
</div>
</body>
</html>

2)price.jsp:

<%@page language="java" import ="java.sql.*" %>
<%
String code=request.getParameter("code");
String buffer="";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from item where code='"+code+"' ");
while(rs.next()){
buffer=":"+rs.getString("itemName")+":"+rs.getString("itemPrice");
}
out.println(buffer);

%>


Related Tutorials/Questions & Answers:
shoping items billng source code
shoping items billng source code  Hi, I am doing a project on invoice making, I am unable to make code for the billing, I have a n jsp page "invc.jsp", here in this page i need to get the items from the data base with respect
shoping items billng source code
shoping items billng source code  Hi, I am doing a project on invoice making, I am unable to make code for the billing, I have a n jsp page "invc.jsp", here in this page i need to get the items from the data base with respect
Advertisements
shoping items billng source code
shoping items billng source code  Hi, I am doing a project on invoice making, I am unable to make code for the billing, I have a n jsp page "invc.jsp", here in this page i need to get the items from the data base with respect
shoping items billng source code
shoping items billng source code  Hi, I am doing a project on invoice making, I am unable to make code for the billing, I have a n jsp page "invc.jsp", here in this page i need to get the items from the data base with respect
shoping items billng source code
shoping items billng source code  Hi, I am doing a project on invoice making, I am unable to make code for the billing, I have a n jsp page "invc.jsp", here in this page i need to get the items from the data base with respect
Shoping Card
Shoping Card  Complete coding for online shoping card
Source code
Source code  source code of html to create a user login page
source code
source code  sir...i need an online shopping web application on struts and jdbc....could u pls send me the source code
source code
source code  sir...i need an online shopping web application on struts and jdbc....could u pls send me the source code
source code
source code  hellow!i am developing a web portal in which i need to set dialy,weekly,monthly reminers so please give me source code in jsp
source code
source code  how to use nested for to print char in java language?   Hello Friend, Try the following code: class UseNestedLoops{ public static void main(String[] args){ char[][] letters = { {'A', 'B'}, {'C','D
source code
source code  how to get the fields from one page to another page in struts by using JSTL
source code - JSP-Servlet
source code  I want source code for Online shopping Cart... Rakesh, I am sending a link where u will found complete source code... of the operations such as: Choose Items View Cart View Bill 1.Choose Items
source code for the following question
source code for the following question  source code for the fuzzy c-means
Java source code
Java source code  How are Java source code files named
source code in jsp
source code in jsp  i need the source code for online payment in jsp
java source code
java source code  java source code to create mail server using struts2
java/j2ee source code
java/j2ee source code  java/j2ee source code for online food purchasing service with my sql database
Hiding Source Code - WebSevices
Hiding Source Code  Is there any way to prevent viewing source code in browser
source code - Swing AWT
source code  source code for a program to shutdown, restart, log off the pc after clicking jbutton on jpanel or a jframe by user. thanks in advance
source code security
source code security  how to obfuscate the code? please answer as soon as possible
source code in jsp
source code in jsp  how to insert multiple images in jsp page of product catalog
Source Code - Java Beginners
Source Code  What do I have to add to my original code to make it work
source code - JSP-Servlet
source code for webcam chat application  I want source code for this webcam chat application. I like the concept of XAWARE ORG regarding web cam chat. So that i want the code through this XAWARE only.pls send the code as soon
request for java source code
request for java source code  I need source code for graphical password using cued-click points enabled with sound signature in java and oracle 9i as soon as possible... Plz send to my mail
source code - JSP-Servlet
source code  please i want source code for online examination project (web technologies)  Hi Friend, Send some details of your project. Thanks
Java Source code
Java Source Code for text chat application using jsp and servlets  Code for text chat application using jsp and servlets
online shoping portal
online shoping portal  Hello Sir/Madam , I am working on a project online shopping portal in Java , I want to share my screen with my friend to show my selected things , can you help me out?what should i do
source code in jsp
source code in jsp  sir...i need the code for inserting images into the product catalog page and code to display it to the customers when they login to site..pls help me
reg : the want of source code
reg : the want of source code  Front End -JAVA Back End - MS Access Hello Sir, I want College Student Admission Project in Java with Source code...) Available Seats and etc. plz Give Me Full Source code with Database
source code - EJB
-of-StatelessBean.shtml", it is written that "The source code for CalculatorBean is in ?net... Simply u download the complete source code from download link...source code   I am new to EJB. I am reading tutorial from http
 

 

 

DMCA.com