No shortcut you have to go serverside to check whether that employee already exists or 
not.

-----Original Message-----
From: Vaishali S. Pandya [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 10:27 AM
To: [EMAIL PROTECTED]
Subject: Re: how to pass current value in function of jsp?


Yes bhushan u r right
i did check this today only and got the point
actually i wanted to do something like shortcut so i do not have to submit
my page
but no alternate is there i suppose and i have to go for it.
right?

Thanks
Vaishali
Reliance Ind Ltd
A'bad




                      Bhushan_Bhangale
                      <Bhushan_Bhangale@I        To:       [EMAIL PROTECTED]
                      NFOSYS.COM>                cc:
                      Sent by: A mailing         Subject:  Re: how to pass current 
value in function of jsp?
                      list about Java
                      Server Pages
                      specification and
                      reference
                      <JSP-INTEREST@JAVA.
                      SUN.COM>


                      07/02/02 10:34 AM
                      Please respond to A
                      mailing list about
                      Java Server Pages
                      specification and
                      reference






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

===========================================================================
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