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




Have Programming Question? Ask it here!
 
 
 


Ragini Shukla
Please Reply
4 Answer(s)      6 years ago
Posted in : Java Beginners



Advertisement
View Answers

August 19, 2008 at 11:54 AM


Hi friend,


Code to solve your problem :

"vendmaster.jsp"


<html>
<head>

</head>
<body>

<form name="vendForm" method="post" action="vendmid.jsp">
<table>


<tr>
<td>Vend Id</td>
<td><input type="text" name="vend_id" value=""></td>
</tr>
<tr>
<td>Vend Name</td>
<td><input type="text" name="vend_name" value=""></td>
</tr>

<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>


</body>
</html>



August 19, 2008 at 11:55 AM


To insert vendmaster form "vendmid.jsp"

<%@ page language="java" import="java.sql.*;"%>
<%

// initialze the parameter form

String vend_id = "";
String vend_name = "";


// initialze the database connectivity
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String userPassword = "root";
String submit="";


if(request.getParameter("Submit")!=null)
{
vend_id = request.getParameter("vend_id");
vend_name = request.getParameter("vend_name");
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,username,userPassword);
Statement st = conn.createStatement();
String strQuery=null;

strQuery = "insert into vend_master set vend_id='"+vend_id+"',vend_name='"+vend_name+"'";
int rs = st.executeUpdate(strQuery);

System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}

%>


August 19, 2008 at 11:56 AM


To create a prodmaster form "prodmaster.jsp"

<%@ page language="java" import="java.sql.*;"%>
<html>
<head>

</head>
<body>

<form name="prodForm" method="post" action="prodmid.jsp">
<table>

<tr>
<td>Product Id</td>
<td><input type="text" name="prod_id" value=""></td>
</tr>
<tr>
<td>Product Name</td>
<td><input type="text" name="prod_name" value=""></td>
</tr>

<tr>
<td>Product Id</td>
<td><input type="text" name="prod_opstock" value=""></td>
</tr>
<tr>
<td>Product Name</td>
<td><input type="text" name="prod_excise" value=""></td>
</tr>

<tr>
<td>Product Id</td>
<td><input type="text" name="prod_vat" value=""></td>
</tr>
<tr>
<td>Product Name</td>
<td><input type="text" name="reorder_level" value=""></td>
</tr>
<tr>
<td>Product Id</td>
<td><input type="text" name="reorder_qty" value=""></td>
</tr>
<tr>
<td>Product Name</td>
<td><select name="vend_id">
<%
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String userPassword = "root";
String submit="";






try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,username,userPassword);
Statement st = conn.createStatement();
String strQuery=null;



strQuery = "select * from vend_master";
ResultSet rs = st.executeQuery(strQuery);
out.println(strQuery);
while(rs.next())
{
%>

<option value="<%=rs.getString(1)%>"><%=rs.getString(2)%></option>
<%
}



System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}


%>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>


</body>
</html>




August 19, 2008 at 11:58 AM


To save data prodmaster in database "prodmid.jsp"


<%@ page language="java" import="java.sql.*;"%>
<%

// initialze the parameter form

String prod_id = "";
String prod_name = "";
String prod_opstock = "";
String prod_excise = "";
String prod_vat = "";
String reorder_level = "";
String reorder_qty = "";
String vend_id = "";


// initialze the database connectivity
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String userPassword = "root";
String submit="";


if(request.getParameter("Submit")!=null)
{

prod_id = request.getParameter("prod_id");
prod_name = request.getParameter("prod_name");
prod_opstock = request.getParameter("prod_opstock");
prod_excise = request.getParameter("prod_excise");
prod_vat = request.getParameter("prod_vat");
reorder_level = request.getParameter("reorder_level");
reorder_qty = request.getParameter("reorder_qty");
vend_id = request.getParameter("vend_id");

out.println(vend_id);
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,username,userPassword);
Statement st = conn.createStatement();
String strQuery=null;

strQuery = "insert into prod_master set prod_id='"+prod_id+"',prod_name='"+prod_name+"',prod_opstock='"+prod_opstock+"',prod_excise='"+prod_excise+"',prod_vat='"+prod_vat+"',reorder_level='"+reorder_level+"',reorder_qty='"+reorder_qty+"',vend_id='"+vend_id+"'";

int rs = st.executeUpdate(strQuery);

System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}

%>

For read more information

http://www.roseindia.net/

Thanks

vineet


Related Tutorials/Questions & Answers:
Please Reply - Java Beginners
Please Reply  Hi, I have a form these fields r prod_id,prod_name,prod_opstock,prod_excise,prod_vat,reorder_level,reorder_qty,vend_name... should be stored vand_id in the place of vend_name Please write a code
Java Program(Please reply asap)
Java Program(Please reply asap)  Find out the ways in which numbers can be added to get the same result Example:- 10 1+9=10 1+2+3+4=10 1+9=10
Advertisements
Would you know answer means please send reply urgent
Would you know answer means please send reply urgent  HTTP Status 404 - /struts/HelloWorld.jsp type Status report message /struts/HelloWorld.jsp description The requested resource (/struts/HelloWorld.jsp) is not available
struts problem ... need help urgently.. please reply ASAP
struts problem ... need help urgently.. please reply ASAP  Hi Every1, I want to make an application using struts 1.2. I am a beginner on struts... depends on server or IDE. Please reply ASAP. Thanx , am2085
please reply fast if anyone knows that how to install mysql on windows using msi package
please reply fast if anyone knows that how to install mysql on windows using msi package  please reply fast if anyone knows that how to install mysql on windows using msi package   Hello Friend, visit here Thanks
reply must
reply must  is it critical to do a software job based on games(java) i know core java & advanced java basics only please give me answer
reply to the mail
reply to the mail  Hi! which jar file needed to be added? Thanks   Question not clear
Reply Me - Java Beginners
Reply Me  Hi, This is not correct url please send me again coorect url
Reply - Struts
Reply   Thanks For Nice responce Technologies::--JSP please write the code and send me....when click "add new button" then get the null value...its urgent...  Hi can u explain in details about your project
Reply - Struts
Reply  Hello Friends, please write the code in struts and send me I want to display "Welcome to Struts" please send me code its very urgent... and which file need to be run and compile struts without using database
Reply - Struts
Reply  I am sending some coding please chk and let me know if(act==3) { W=0; while(W< (txtcnt4-1)) { out.println("1st Details==::" + request.getParameter("txtICNAMEOFOCCP" + W
Reply me - Java Beginners
Reply me  Hi,   Hi Ragini please specify main problem. where are problem in your code. Thanks
reply - Java Beginners
reply  Hi friends I have a 255 fields i want to insert data in the table please let me know how to insert data in the database please reply me its very urgent
Reply me - Java Beginners
Reply me  Hi Friends, Quest:- Tell em what is the difference between java and php, dotnet Quest:- what is the similar point of php and java... Please tell me its very urgent
Reply Me - Java Beginners
=13c222b87273340cf002bfba4ab9d045. please reply me fast its urgent...Reply Me  Hi All, I want to using query string in my page please write the query string in java script and send me and I have a some link
Reply Me - Struts
Reply Me  Hi Friends, Please write the code using form element...because i got error in textbox null value  Hi Soniya Would you please explain, in which technology are you creating page? I promise
Reply me - Java Beginners
Reply me  If u r not understood my just posted question plz let me know  Hi Ragini, Please specify your requirements in detail. It would be good for me to provide you the solution if problem is clear. And also
Reply Me - Struts
Reply Me  Hi Friends, I am new in struts please help me... file,connection file....etc please let me know its very urgent   Hi Soniya, I am sending you a link. This link will help you. Please
Reply me - Java Beginners
Reply me  Hi, There are one form product_master these fields are prod_id,prod_name,prod_opstock,prod_excise,prod_vat,reorder_level,reorder_qty... in the place of vend_name Please write this code and send me its very urgent
reply me - Java Beginners
reply me  Hi, user enter vend_id in text box ten open the addform.jsp In the addform.jsp have two button Update and delete... is incorrect user click delete button then file is not called please send
Reply me - Java Beginners
Reply me   Hi, I am using this code for session but i am... then adll data would be displaying. so please tell me what is incorrect my code and i want to use session in each page then please tell me that how can i
Reply Me - Java Beginners
Reply Me  Hi Amardeep I am sending database table name,code and db file please insert this data in this table its very urgent.... My... "code too large for try statement" please help me its very urgent
Reply - JSP-Servlet
numberformat exception to display "Please enter Valid ID" in the form of an alert box... Thanks for your fast reply.. Thanks/Regards, R.Ragavendran..  
Reply Me - Java Beginners
Reply Me  Hi, Please Help Me using jsp technologies I have a form click the link and open the popup window main page have already a html... understood my problem then please send me.....  Hi friend, Please
Reply Me - Java Beginners
Reply Me  Hi deepak, your sending web application is good (alphabetical searching dropdown menu) Steps:- 1:-searching is good... will be not displayed. please help me how it is open selection of the user its very urgent
Reply me soon.........
Reply me soon.........  Any body plzz help.....how to get d checked details from previous page to current page and den insert into table
Reply Me - Java Beginners
Reply Me  Hi, I m working in jsp please any information provide... based onsearching Search with name alphabetical order please understood,if u not understood then please tell me Thanks   
Reply Me - Java Beginners
Reply Me  Hi,.. I have a some fields in one form like security and some more fields this fields maintain the table if user click security... question then reply me
Reply me - Java Beginners
Reply me  Hi, this code is .java file but i am working in jsp... in the database... if u understood my question then then please send me code oterwise... please send ur number i describe you Thanks Rajanikant
Reply Me - Java Beginners
Reply Me   Hi I am sending some code please check it and solve this code is only insert into the data base please insert data in the database table and reply me fast...I got two error 1 is catch is without try 2 is try
Reply Me - Java Beginners
Reply Me  Hi, For table I have a two table first is sales transaction and second is sales_line sales_transaction fields are comp_id,vend.... * JSP * Servlets * Struts 1 * Struts 2 or JSF? Please tell me
Reply Me - Java Beginners
Reply Me  Hi Rajnikant, I know MVC Architecture but how can use this i don't know... please tell me what is the use of this ....and also solve my previous problem.... Thanks   Hello Ragini MVC
Reply - Java Beginners
Reply  Hi amardeep Thanks for reply i know my code is very large....i am sending database table file please chk sequence and let me know... is correct. Please, can you send DbBean class file. http
hi plzz reply
hi plzz reply  in our program of Java where we r using the concept of abstraction Plz reply i m trying to learn java ...   means in language of coding we r not using abstraction this will be used only for making ideas
Reply Me - Java Beginners
Reply Me  Hi, Details structure Using jsp code I m sending table structure and again sending our problem Steps:- 1:-If user input in name text box like a,then display record related to a not b and c(means
Reply me - Java Beginners
Reply me  HI I m sending structure of table vend_id,vend_name,vend_address,vend_mobile,vend_panno,vend_phone,vend_creditday,vend_tinno this is the table and i want searchning table field using name and display wole
reply - Java Beginners
reply  Hi Friends, action *.do please tell me... tell me what is main role of *.do please tell me its urgent.....  HI ragini, Please tell me, what you want to do? if you are using simple
rEPLY - Java Beginners
rEPLY  hi, This is session code i am calling admin_home1.jsp then data will be not displaying its urgent requirement please send me correction Thanks   Hi friend, To display the session
Reply - Java Beginners
Reply  Hi friend I want to use eclipse in my system then send me url of this I have a jdk1.4, tomcat 4.1 so please tell me which version is support give detail how to install
reply - Java Beginners
sheet and give the save button and and click save in excel format please write
fast Reply - Java Beginners
fast Reply  Hi Friend I want to passing value one page to another page without using session varible....please help me write the code and send me   Hi friend, For solving the problem visit to : http
reply - Java Beginners
reply  Hi friend, please send query count the column name in oracle  Hi friend, Code to solve the problem : import java.sql.*; public class ColumnCount { public static void main(String[] args) throws
Reply - JSP-Servlet
get the codings please send it to me at that moment itself.. Because i am...("Please Select Employee Id"); return false; } return true
reply - Java Beginners
reply  Hi, I am chk insert query please chk and let me know what is incorrect here i am using insert query please chk this StrSqlColm="Insert into FAFORM24GJMASTER("; StrSqlColm="USERCODE,POSTDATE
Reply - Java Beginners
Reply  Hi, This is the admin_home page i give .html extention then data is not displaying and i give .html extention then all data is displaying so please tell me where is incorrect .:: Riddhi Siddhi General
Reply to the mail(import files error)
Reply to the mail(import files error)  Hi Its already there in the bin. If its class path should be set , how can i do dat?   Hi, Wait...; Hi, Please read out Hibernate Getting Started tutorial. Here you will find
Reply to the mail(import files error)
Reply to the mail(import files error)  Hi! Thank you. That error has gone and i have worked out an example, but its giving a null pointer exception... that contact.hbm.xml must be present the classpath. Thanks   Hello, Please
Reply to ur mail(Hibernate Error)
Reply to ur mail(Hibernate Error)  Hi! Im using Eclipse. Steps : 1. Downloaded the example code and library from rose india and extracted the content in a directory. 2. Downloaded file contains the Eclipse project. 3. Started
Plz chk it and reply again - Java Beginners
fast reply.  Hi Ragini, Please specify your requirements...Plz chk it and reply again  Hi Deepak, Thanks for fast reply,your application is good,u write this code for user click the view database
 

 

 

DMCA.com