Programming Error

Programming Error

Domain Table:--

Rfcdkey DomainName DomainValue DepDomainValue Statcd
1 StateCd Maharashtra Mumbai A
2 StateCd Maharashtra Pune A
3 StateCd Maharashtra Nashik A
4 StateCd Karnataka Bangalore A
5 StateCd Delhi Delhi A
6 StateCd West Bengal Kolkata A
7 StateCd West Bengal Dargeeling A
8 Category Matrimonial Bride A
9 Category Matrimonial Groom A


PlaceAd.jsp:--code

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

<%
Connection con=null;
Statement stmt=null;
//String st;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:Advdsn");
stmt=con.createStatement();
}
catch(SQLException se){
out.println("Database Error:"+se.getMessage());
}
catch(Exception e){
e.toString();
}
%>
<html>
<head>
<script language="JavaScript">
function Draft(text1,text2){
var v1=text1.value;
var v = 0;
v2=v1.replace(/\s/g,' ');
v2=v2.split(' ');
for (i=0; i<v2.length; i++) {if (v2[i].length > 0) v++;}
text2.value=v;
}
function checkPhoneNo(num){
if(isNaN(num)){alert("Invalid Phone Number. The only characters permitted are 0 to 9"); return 0;}
else{return 1;}
}
function Validate()
{
var phone=document.form.PhoneNo;
var email=document.form.Email;
if(email.value=="")
{ alert("Please enter valid Email Id");
return false;
}
apos=email.value.indexOf("@")
dotpos=email.value.lastIndexOf(".")
if (apos<1 || dotpos-apos<2)
{
alert("Invalid Email Id")
email.value=="";
email.focus();
return false;
}

if((phone.value=="")||(phone.value==null))
{ alert("Please enter valid PhoneNo");phone.focus();
return false;
}
if (checkPhoneNo(phone.value)==false){
phone.value="";
phone.focus();
return false;
}
if ((phone.value.length==8)||(phone.value.length==10)){
return true;
}
else{
alert("Phone Number must be of 8 numbers or 10 numbers");
return false;
}
return true;
}


</script>
</head>

<body bgcolor="lightblue">
<marquee behavior="alternate" scrollamount=5 scrolldelay=10><h1><font size=4 face="Stroustroup" color="#993355">Advertisement Management System</h1></font></marquee><br>
<p align=center><b> <font color="669933" size=4>Create Ad </font></b></p><br>
<% String no=request.getParameter("OrderNo");
out.println("The Placing of Ad is of Order Number "+no+"<br>"); %>
<form name="form" method="post" action="Preview.jsp" onsubmit="return Validate();">
<table>
<tr><td>State:</td><td> <select name="State" size=1>
<%
ResultSet state=stmt.executeQuery("SELECT distinct DomainValue FROM Domain WHERE DomainName = 'StateCd' Order by 1");
while(state.next())
{
String st=state.getString("DomainValue");
%>
<option value="<%=st %>">
<%

out.println(st); %>
</option>
<%}%>
</select></td></tr>
<tr><td>City:</td><td> <select name="City" size=1>
<%
ResultSet city=stmt.executeQuery("Select DepDomainValue from Domain where DomainName='StateCd' and DomainValue=(SELECT distinct DomainValue FROM Domain WHERE DomainName = 'StateCd') ");
while(city.next())
{
String ci=city.getString("DepDomainValue");
%>
<option value="<%=ci %>">
<%

out.println(ci); %>
</option>
<%}%>
</select></td></tr>
<tr><td>Main Category: </td><td><select name="mainCat" size=1>
<%
ResultSet mainC=stmt.executeQuery("SELECT distinct DomainValue FROM Domain WHERE DomainName = 'Category' Order by 1 ");
while(mainC.next())
{
String mc=mainC.getString("DomainValue");
%>
<option value="<%=mc %>">
<%

out.println(mc); %>
</option>
<%}%>
</select></td></tr>

<tr><td>Sub Category:</td><td><select name="subCat" size=1>
<%
ResultSet subC=stmt.executeQuery("Select DepDomainValue from Domain where DomainName='Category' and UCase(DomainValue)=ucase('Matrimonial') Order by 1");
while(subC.next())
{
String sc=subC.getString("DepDomainValue");
%>
<option value="<%=sc %>">
<%

out.println(sc); %>
</option>
<%}%>

</select></td></tr>
<tr><td>Title:</td><td> <input type=text name="Title" size=25 ></td></tr>
<tr><td>Draft Your Ad here:</td><td><textarea name="DraftAd" cols="15" rows="2" onkeyup="Draft(this,document.form.Count)"></textarea></td></tr>
<tr><td>No of words:</td><td><input name="Count" type="text" value="0" onkeyup="Draft(document.form.DraftAd,this)" readonly></td></tr>
<tr><td>Image:</td><td><input type="file" name="img"></td></tr>
<tr><td>Email:</td><td><input type=text name="Email" size=25></td></tr>
<tr><td>Phone No:</td><td><input type=text name="PhoneNo" size=25 maxlength=10></td></tr>
<tr><td>Select Newspaper:</td><td><select name="NewsPaper" size=1>
<%
ResultSet news=stmt.executeQuery("SELECT distinct DomainValue FROM Domain WHERE DomainName = 'Newsp' Order by 1");
while(news.next())
{
String np=news.getString("DomainValue");
%>
<option value="<%=np %>">
<%

out.println(np); %>
</option>
<%}%>
</select></td></tr>
<br>
<tr><td>Select Your Date:</td><td><select name="day" size=1>

<%for (int date=1;date<=31;date++)
{
%>
<option value="<%=date%>"><%=date%></option>
<%}%>
</select></td></tr>
<tr><td>Month:</td><td><select name="Month" size=1>
<%
for (int month=1;month<=12;month++){
%>
<option value="<%=month%>"><%=month%></option>
<%}%>
</select></td></tr>
<tr><td>Year:</td><td><select name="Year" size=1>
<%
for (int year=2010;year<=2050;year++){
%>
<option value="<%=year%>"><%=year%></option>
<%}%>
</select></td></tr>
<tr><td>Select Number of Days:</td><td><input type=text name="numDays" size=5></td></tr>
<tr><td><input type="submit" name="submit" value="Preview"></td></tr>
</form>
</body>
</html>



Above This is the Domain Table created in access.
I loaded all values from Domain table in PlaceAd.jsp
but i want that if user selects Maharashtra then only city related to that state must be visible in city combo box.
Eg: if Maharashtra is selected then only mumbai,pune and nashik must be visible in city combo box ??
Please Reply me Sir how to do this actually i tried but its giving me error??
So Please Reply me.
Thank You Sir.

View Answers









Related Tutorials/Questions & Answers:
programming error
programming error  I got an error when i did the following program the prg. is to "select the name from database when the age is given for the respective name" error i got is:SQL exception please give me the solution by providing
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
Advertisements
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class Login extends HttpServlet { public void doPost(HttpServletRequest req,HttpServletResponse res
error at programming
error at programming  <p>import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*;</p> <p>public class Login extends HttpServlet { public void doPost(HttpServletRequest
Programming Error - JSP-Servlet
Programming Error  Hello Sir, how to convert a txt written in textarea of html must get converted to integers and should get displayed... integer.parseInt but its giving error. Please Reply me . Thank you
Programming Error - JSP-Servlet
Programming Error   Place Ad function funct(){ if(document.form.DraftAd.value=="" || document.form.DraftAd.value==null... ??? And when i tried its giving me error than cannot find variable.In
Programming Error - JSP-Servlet
Programming Error  Hello Sir, import java.util.*; import...(); } } }//End of class m geeting error in this can u please tell me whats the error nd how to solve
Programming error - JDBC
Programming error  import javax.servlet.*; import...) { out.println("Database Error :"+se.getMessage()); } catch(Exception e) { out.println(e.toString()); } } } Please reply me the error in this program because i
programming error - Java Beginners
programming error  how can we statically implement linked list????????  Hi Friend, Please visit the following links: http://www.roseindia.net/java/jdk6/LinkedListExample.shtml http://www.roseindia.net/java
Programming error - JSP-Servlet
Programming error  Actually there is an error in placeorder.jsp file where there are 5 fields OrderNo ,Name , Address, Email, PhoneNo where if I delete an order of client based on orderno then suppose in database if there are 5
Programming Error - JSP-Servlet
Programming Error   Place Order function checkName...(""); } catch(SQLException se) { out.println("Database Error :"+se.getMessage()); } catch(Exception e) { out.println("General Error :"+e.getMessage
Programming error - JSP-Servlet
Programming error  Register.jsp Registration..."); } catch(SQLException se) { out.println("Database Error :"+se.getMessage()); } catch(Exception e) { out.println("General Error :"+e.getMessage()); } %>
programming error - Java Beginners
programming error  import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; public class Place_Ad extends...(SQLException se) { out.println("Database Error :"+se.getMessage()); } catch(Exception e
programming error - Java Beginners
programming error  What is error in this page and how to use RequestDispatcher in servlet to validate it please do reply?? import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import
Programming error - JSP-Servlet
Programming error   --%> Place Order function Validate() { var valid=true; if(document.forms.OrderNo.value=="") { alert... where if @ is not given or (dot). is not given etc then it should display error
Programming error - JSP-Servlet
Programming error  Hello Sir, Can u please reply me the code for javamail please actually i watch the javamail.net but i dint understood it. Actually i want to send a mail to my clients with a small text message. Please
Programming Error - JSP-Servlet
Programming Error  Image: I want that when user clicks on browse button then a folder of images should get open and when user clicks one image from it (only one not more than that)then it should get displayed on next page
Programming Error - JSP-Servlet
Programming Error   Place Ad function funct(){ if(document.form.DraftAd.value=="" || document.form.DraftAd.value==null) { document.form.cnt.value=0;} else {document.form.cnt.value
Programming Error - JSP-Servlet
Programming Error   Payment Advertisement Management System Payment Premium Position FrontPage BackPage Other Premium Pages Page 2 Page 3 Page 5 Page 7 Total Cost: How to use switch
Programming Error - JSP-Servlet
Programming Error  Image: Browse When user clicks on Browse Button then a folder of images should get open and when user clicks one of them then the path of that should get saved in Access Database and on next page
Programming error - JSP-Servlet
Programming error   Payment Advertisement Management System Payment Premium Position FrontPage BackPage Other Premium Pages Page 2 Page 3 Page 5 Page 7 Total Cost: I want that the no of characters
Programming Error - JSP-Servlet
Programming Error   function Draft() { if(document.form.Count.value==""||document.form.Count.value==null) document.form.Count.value=0; else document.form.Count.value = document.form.DraftAd.value.split(' ').length
Programming Error - JSP-Servlet
Programming Error  How to validate login page using jsp where it checks for username whether it is empty or not or is it including number or not if it is the paste alert message.   Hi Friend, Try the following
Programming Error - JSP-Servlet
Programming Error   Place Ad Advertisement Management System Create Ad State: City: Main Category: Sub Category: Title: Draft Your Ad Here
Programming Error - JSP-Servlet
Programming Error  Ya States and cities and maincategory and subcategory are combobox and maincategory contains suppose matrimonial then sub category will contain groom and bride, if main category contains vehicals then sub
Programming Error - JSP-Servlet
Programming Error   MainPage body { font-family:arial,helvitica,serif; color:purple; background-color:#717D7D; } ul { list-style-type:none; margin:0; padding:4px; } li { list-style-type:none; padding
Programming Error - JSP-Servlet
Programming Error  Domain Table:-- Rfcdkey DomainName DomainValue DepDomainValue Statcd 1 StateCd Maharashtra Mumbai A 2 StateCd Maharashtra Pune A 3 StateCd Maharashtra Nashik A 4
Programming Error - JSP-Servlet
Programming Error  Place.jsp function func(){ var filename = document.form.img.value; var st=document.form.State.value; var ci=document.form.City.value; var main=document.form.mainCat.value; var sub
Programming error - JSP-Servlet
Programming error   Place Order function checkName(text) { if(isNaN(text)){ return 1;} else{alert("Invalid Name! The only charachters accepted are A - Z and a - z");return 0;} } function checkPhoneNumber
programming error - JSP-Servlet
programming error   Place Order function Validate() { var valid=true; if(document.forms.OrderNo.value=="") { alert("Please enter valid OrderNo"); valid=false; } if(document.forms.Name.value
Programming Error - JSP-Servlet
Programming Error   Place Ad Advertisement Management System State: City: Main Category: Sub Category: Title: Draft Your Ad Here: Count: Image Another Image Email: Phone No: Select Newspaper
Programming Error - JSP-Servlet
Programming Error  import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class SendMail { public static void main(String args[]) throws Exception { String host = "192.168.10.205
Programming Error - JSP-Servlet
Programming Error   Place Ad function func() { var filename = document.form.img.value; window.location.href=("http://localhost:8080/ProjectAd/Preview? filename="+filename); } function Draft
Programming error - Java Beginners
Programming error  import javax.servlet.RequestDispatcher; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class ModuleServlet extends HttpServlet { public void doGet(HttpServletRequest
Programming error - JSP-Servlet
Programming error  Place.jsp code function func(){ var filename = document.form.img.value; var st=document.form.State.value; var ci=document.form.City.value; var main=document.form.mainCat.value; var sub
Programming Error - JSP-Servlet
Programming Error  import javax.servlet.*; import java.io.*; import javax.servlet.http.*; import java.sql.*; public class UpdateOrd extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse
Programming
Programming  Given a number n, write a programming to determine its square root if it is possible, in the contraly case print an appropriate massege on the screen
programming
Java Constructor programming for single and double constructor  write a program which have no argument constructor ,single parameter constructor constructor,double parameter constor,and the now when we create a object
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower

Ads