Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

how to display textbox value based on selected option value?

Ads

 
 

Share on Google+Share on Google+

k
how to display textbox value based on selected option value?
0 Answer(s)      6 years ago
Posted in : Ajax
Hi,I have some problem. I use jsp and ajax.
first select: 1
second select:2 based on first value
 I finished above code.

ID: xx   Name:xx  xx is baesd on second and first value. But it is that l can't do that.


now, l post my code(not finished) here:
      function showdoc(id){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/FYP/booking/getdocinfo.jsp"
url=url+"?doctor="+id
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("doc_id").value= strar[1];
        document.getElementById("doc_name").value= strar[2];


         }
       }
     }


getdocinfo.jsp
<[email protected] language="java" import ="java.sql.*" %>
 <%
 Connection conn = null;
    String url = "jdbc:oracle:thin:@kk132.no-ip.org:1521:";
    String dbName = "XE";
    String driver = "oracle.jdbc.OracleDriver";
    String userName = "xx";
    String password = "xx";

 String doctor=request.getParameter("doctor").toString();
 String buffer="<tr><td>";
 Class.forName("oracle.jdbc.OracleDriver").newInstance();
 Connection con = DriverManager.getConnection(url+dbName,userName,password);
 Statement stmt = con.createStatement();
 String data="";
 ResultSet rs = stmt.executeQuery("Select * from DOCTOR where DOCTOR_ID='"+doctor+"'");
//out.print("<table border='1'>");
 //out.print("<tr><th>Employee ID</th>");
 //out.print("<th>Employee Name</th>");
//out.print("<th>Date</th>");
//out.print("<th>Time</th></tr>");
   while(rs.next()){

   data = ":" +rs.getString("DOCTOR_ID") +":"+ rs.getString("DOCTOR_NAME");

   }
 //buffer=buffer+"</td></tr></table>";
 System.out.println(data);
  //response.getWriter().println(data);


 %>
so, hope you help me. thanks
Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Advertisements