Hello Vaishali,

I guess you are doing something wrong here. Tell me are you thinking that when the 
onBlur event will occur your code will execute the checkemp(String) method? If yes 
then you are wrong as the checkemp method will execute when the JSP will get served. 
So in the source of generated html you will see onBlur="change(true/false)" already 
written there. This way you can't pass the emp_no value tho that method. To do so you 
need to submit the form to serverside.

-----Original Message-----
From: Vaishali S. Pandya [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 5:01 PM
To: [EMAIL PROTECTED]
Subject: how to pass current value in function of jsp?


<%!
      public static boolean checkemp(String emp){
            MyConnection con=new MyConnection();
            Statement stmt = null;
            ResultSet rs = null;
            try{
                  stmt = con.getCon(1);
                  rs = stmt.executeQuery("select * from hrm_employee_mas
where emp_employee_no = " + emp);
                  if (rs.next()){
                        return (true);
                  }
                  else{
                        return (false);
                  }
            }
            catch(Exception e){
                  System.out.println(e);
            }
            return (true);
      }
%>
<script>
      function change(res){
            if (res==true){
                  alert("Employee allready exists");
                  document.femp.emp_no.focus();
            }
</script>

<INPUT type=text name=emp_no  value="<%=emp%>"  onblur="change(<%=checkemp
(?)%>)">

what should i write here ?
i want to pass current value of emp_no
in javascript i can write this.value
what about jsp?
any idea?
Thanks in advace

Regards
Vaishali
Reliance Ind Ltd
A'bad

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to