The error im getting is object expected.
This is my jsp page:
This is my javascript page:
Edit/Delete Message
This is my jsp page:
Code:
<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost/new";
Connection connection = null;
Statement statement;
ResultSet rs;
%>
<html>
<head>
<script type="text/javascript" src="Task113.js">
</script>
</head>
<body>
<%
String s=request.getParameter("q");
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(connectionURL, "root", "cng");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT prid FROM project where pid='"+s+"'");
String targetId=request.getParameter("q");
%>
<form name="myform1" method="post" action="Task113.jsp">
Projects for Program are :
<select name="project" id="project" style="width: 100px" onChange="showCustomer6('this.value')">
<%
while(rs.next())
{
String result=rs.getString(1);
String home="unbounded";
%>
<%
out.println(s+" consist of :<br>");
if(targetId.equalsIgnoreCase("unbounded"))
{%>
<option value="<%= home %>">
<%= home %>
</option>
<%}
else if(targetId.equalsIgnoreCase("Program 1"))
{%>
<option value="<%= result %>">
<%= result %>
</option>
<%}
else
{%>
<option value="<%= result %>">
<%= result %>
</option>
<%}
}
%>
</select>
</form>
</body></html>
This is my javascript page:
Code:
var xmlhttp
function showCustomer6(str)
{
alert("1");
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="dummy.jsp";
url=url+"?q1="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlht tp.responseText;
}
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
Comment