
Hello Sir. I m using Oracle 10g as a database n tomcat server DSN name : NB Username NB Password EBS Table name consumer
When i run jsp page on the browser it only shows the code nothing else..
I have made two files which are as follows
1)New.jsp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<title>Net Bill</title>
<link rel="stylesheet" type="text/css" href="C:\NB\stylesheets\main.css"></link>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="header">
<center><p style="padding-top:30px; font-size:40px; color:#000040;">Net Bill</p></center>
</div>
<div class="nav">
<ul style="list-style-type:none; margin:0px; padding:0px; overflow:hidden;">
<li style="float:left"><a href="C:\NB\Index.html">Home</a></li>
<li style="float:left"><a href="C:\NB\About.html">About Us</a></li>
<li style="float:left"><a href="C:\NB\How.html">How it Works</a></li>
<li style="float:left"><a href="C:\NB\Contact.html">Contact Us</a></li>
</ul>
</div>
<!-- Start of FORM -->
<form method="post" action="insert.jsp.">
<table style="width:700px; height:200px; margin:10px 80px; padding-top:10px; padding-left:30px; font-size:20px; border-radius:6px; background-color:#000000; color:#C0C0C0;">
<tr>
<td>
First Name : <input type="text" name="fname">
Last Name : <input type="text" name="lname"></br></br>
User Name : <input type="text" name="uname"></br></br>
Password :   <input type="password" name="pass"></br></br>
Gender : <input name="Gender" type="radio" value="M">Male
<input name="gender" type="radio" value="F">Female<br></br>
Age : <input type="text" name="age"></br></br>
State :   <input type="text" name="state"></br></br>
Mobile :   <input type="text" name="mno" float="left"></br></br>Address :</br></br>
  <textarea style="width:200px; height:50px;"name="address"></textarea></br></br></br>
<center><button type="Submit" name="send" width="100px" height="10px">Submit</button></td></center>
</tr>
</table>
</form>
<!-- End of FORM -->
<div class="footer">
<center><strong>Copy Rights @ Arth Parikh</strong></div></center>
</body>
</html>
2) insert.jsp
<%@ page import="package oracle.jdbc.driver;" %>
<%@ page language ="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%
String fname = request.getParameter("fname");
String lname = request.getParameter("lname");
String uname = request.getParameter("uname");
String pass = request.getParameter("pass");
String gender = request.getParameter("gender");
String age = request.getParameter("age");
String state = request.getParameter("state");
String address = request.getParameter("address");
String mno = request.getParameter("mno");
int mno=Integer.parseInt(request.getParameter("mno"));
try{
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","NB","EBS")
Statement st=conn.createStatement();
Resultset rs=st.executeUpdate("insert into consumer(fname,lname,uname,pass,gender,age,state,address,mno) values('"+fname+"','"+lname+"','"+uname+"','"+pass+"',"+age+",'"+gender+"','"+address+"','"+state+"',"+mno+")");
out.println("Data is successfully inserted!")
}
catch(Exception e)
{
System.out.print(e);
e.printStackTrace();
}
%>
Sir please help me as soon as possible my project is on stand by...so soon want a perfect solution.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.