0

After getting the user_name on client side using the below code :

<script type="text/javascript">
        var WinNetwork = new ActiveXObject("WScript.Network");
        var user_name = WinNetwork.UserName;
</script>

I was blocked how to pass the value of the variable "user_name" to the java code below,in order to test if this user exists on an oracle table :

<%
    try {           
        ResultSet rs1 = stmt
                .executeQuery("select * from utilisateur where upper(login) like upper('" + user_c + "')");

        if (!rs1.next()) {
            int i6 = stmt.executeUpdate("insert into utilisateur(login) values('" + user_c + "')");
        }
    }
    catch (Exception e) {
        System.out.print(e);
        e.printStackTrace();
    }
%>
nonely
  • 53
  • 6
  • Possible duplicate of [How do I pass JavaScript values to Scriptlet in JSP?](https://stackoverflow.com/questions/5701031/how-do-i-pass-javascript-values-to-scriptlet-in-jsp) – soorapadman Jul 12 '18 at 12:07

1 Answers1

0

In this case,you can’t get the user variable ,because jstl,el,is java code,when you render this page,it will go first ,then the html go second. So you will see the blank in this two variable .

MAX
  • 53
  • 9