Javascript calling Java class

Hello, kindly help. I am calling a java class file for validating a username and password. The browser returns no error but it seems that execution does not even pass my class file.
Here is my class file.
import java.sql.*;
import java.applet.Applet;
public class auth extends Applet {
boolean isAuth = false;
String h;
public void init() {
h = "hello"; }
public void login(String user, String pwd) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:test");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from users where username ='" + user + "'");
if (rs.next()) {
pswd=rs.getString(2).trim();
     if (pswd.equals(pwd)) {
this.isAuth = true;
rs.close();
con.close();
} catch (Exception ex) {
System.out.println(ex);
Here is aportion of my HTML file.
<script language="JavaScript">
<!--
function auth_user(u, p) {
     document.auth.login(u, p);
     alert (document.auth.h); // property is undefined
     if (document.auth.isAuth) // property is undefined
          alert("User authenticated!");
     } else {
          alert("User not authenticated!");
//-->
</script>
<applet code="auth.class" name="auth" width="1" height="1" id="auth"></applet>
     <form action="" method="post" name="login" id="login">
<input name="uname" type="text" id="uname2" maxlength="10">
<input name="upwd" type="password" id="upwd2" maxlength="10">
          <INPUT TYPE="button" VALUE="Login" onClick="auth_user(document.login.uname.value, document.login.upwd.value)">
Many thanks,

is it running when you making that call? i.e. i hope
you have a lot more in the body of your applet than
just a string assignment. The applet successfully initialized upon loading. However, even the "auth.h" property which is in the init() and is a simple assignment is undefined when I try to display it.

Similar Messages

  • How to call java class file from jsp

    hi
    we need to call java classes (which are written separately in .java file )from jsp file. we need it for our project if anyone knows about please reply us.
    bye
    siva sankari

    you can call the methods in a lot of ways. you could use scriptlets with the
    <%@ page import="package.class"%> and then inside instantiate an object
    <%
         MyClass mc = new MyClass(parameters if any);
         mc.theMethodYouWantToCall();
    %>or as Madathil has stated,
    or use the JSP tags
    <jsp:useBean id="anyname" class="classname"/>and then use the getProperty tag
    or even Custom Tags

  • Calling java class from jsp page

    Dear Friends.
    I wrote jsp page and java class.
    Am calling java class from jsp page. after processing result,
    I have to refresh jsp page from java class.
    processing time may take 5 minutes or 1 minute etc. that depends on user.
    Can It be possible ? if possible , How ?

    Ok, I get a very strange error now:
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
    What is this??? Anyone?

  • Calling java class from abap function moduile

    Is it possible to call java class from function module.
    i am a java guy. my need is to call a java class from a  function module in the backend. which in turn performs certain functions.
    i would be highly obliged if someone could let me know if this is possible.
    regards
    Srikumar V

    Hi Srikumar ,
    you can call a java webservice in ABAP .
    u can call the webservice and via that u can trigger the java class..
    Regards
    Renu

  • Call Java Class and Methods from ABAP

    Hi
    I install de JCo, But how i can call java class and methods from ABAP?. somebody has an example?
    The tutorial say that's is possible,  but don't explain how do that?
    Thanks.
    Angel G. Hurtado

    If you need only simple java program, you do not need to install JCo. The following codes can call java class.
    DATA: COMMAND TYPE STRING VALUE 'C:\j2sdk1.4.2_08\bin\java',
          DIR TYPE STRING VALUE D:\eclipse\workspace',
          PARAMETER TYPE STRING VALUE 'Helloworld'. "here the name of your java program
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
       EXPORTING
         APPLICATION = COMMAND
         PARAMETER = PARAMETER
         DEFAULT_DIRECTORY = DIR
       MAXIMIZED =
         MINIMIZED = 'X'     "If you need the DOS window to be minimized
      EXCEPTIONS
        CNTL_ERROR = 1
        ERROR_NO_GUI = 2
        BAD_PARAMETER = 3
        FILE_NOT_FOUND = 4
        PATH_NOT_FOUND = 5
        FILE_EXTENSION_UNKNOWN = 6
        ERROR_EXECUTE_FAILED = 7
        OTHERS = 8.
    Tell me if it works.
    Nuno.

  • Can anyone help i want to call java class using visual basic

    I want to call java class using visual basic and send some arguments to the main class

    Hi,
    I don't know VB, but you can surely launch a command line like :
    javaw.exe mypackage.MyMainClass myArgument1
    Regards

  • JavaScript: calling Java system code message...

    When I try and call an applet function from Javascript, I get the following message in the output window:
    JavaScript: calling Java system code
    JavaScript: default security policy = file://
    ... and the method isn't called.
    Can someone tell me what I need to do please?

    Research pointers:
    http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/lc.html#1014290
    http://java.sun.com/j2se/1.4.1/docs/guide/plugin/developer_guide/js_java.html

  • BAD CLASS FILE ERROR WHEN TRYING TO CALL JAVA CLASS IN WEB-INF DIRECTORY

    I AM NEW TO THIS FORUM. PLEASE HELP ME IDENTIFY/RESOLVE THIS ERROR - bad class file: /java/tomcat/webapps/ChoiceTel/WEB-INF/classes/XYZ/SMUA.class. OTHER JSP SCRIPTS THAT CALL JAVA CLASSES DO WORK WELL.
    THE FUNNY THING ABOUT COMPILIING THIS JAVA CLASS WAS - I HAD TO A jar xvf OF activation.jar and mail.jar IN THE XYZ DIRECTORY BEFORE SUCCESSFULLY COMPILING SMUA.
    THE CALL BEING MADE FROM THE JSP SCRIPT IS AS FOLLOWS:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <BODY>
    <%@ page import="XYZ.*" %>
    <%!
    %>
    <%
    SMUA sndmail = new SMUA();
    sndmail.postMail ("[email protected]","Test Subject","What Message","[email protected]");
    %>
    </BODY>
    </HTML>

    Dude. Please don't shout. If your keyboard is like mine, it can produce both upper and lower case letters. Please use them appropriately.
    Do you have the activation.jar/mail.jar available in the WEB-INF/lib directory for this application?

  • How to call java class from pl/sql procedure ?

    Hello everyone,
    My query is..
    There is one pl/sql stored procedure which is doing some business logic and storing data in some columns of one table, suppose the table name is 'ABC' .. and the rest of columns of table ABC are getting updated using java class. Now my problem is whenever I insert data in ABC using store proc.. i have to call that java class so that it will update the rest columns ( why java class for updating the columns in ABC is ..because that logic cant be done from pl/sql proc.. it has to be done using java )
    and the other thing is.. oracle is in one machine and java is in another .. :(
    hope ..u can help me out !!
    Thank in advance !!

    but that updation have to be done from java code only.. we are using GIS tools .. have to create some shape files and update the column with that shape file.. so creation of shape file has to be done from java code only..
    so how to call java class file which is on another machine and oracle in another..

  • Call java class by using servlet

    i written simple servlet with doGet(0. I need call java class when i run servlet
    my requirement is when i start the server i will call servlet it will redirect to another page.
    but before that servlet will run java class. which i have written externally.
    i need to run java class by using servlet then it will redirect to another page.
    could you give the proper solution

    You don't call classes - you call methods.
    There's nothing special about servlets except the requirement that they implement HttpServlet. Servlets and other classes they interact with all get compiled into WEB-INF/classes on the server.
    To forward a request to, say, "other.jsp" you do:
    getServletContext().getRequestDispatcher("/other.jsp").forward(request,response);

  • Calling Java class stored in directory from PL/SQL

    Is it possible to call Java class that is stored in directory from PL/SQL
    or must those Java classes be stored in Database?
    Has anyone any information considering this?
    Cheers,

    user529557,
    You have the following options:
    * Web Services
    * Servlets
    * EJB
    * RMI
    * JMS
    There may be others.
    Good Luck,
    Avi.

  • Calling java classes from plsql procedures

    I'm attempting to call java classes from plsql procedures which will create cmsdk users, folders, groups etc, however when I attempt to load a java class into the oracle schema using the command:
    loadjava -user user/password@database -resolve classname.class
    It generates error messages to the effect that classes (cmsdk classes) required by the class cannot be found. The class is loaded and marked with the status "invalid". Is it therefore necessary for me to load the cmsdk packages into the schema?
    Cheers
    David

    Using CMSDK Java API within the database has never been supported
    (see Problems loading IFS's java class into database
    When we needed to invoke CMSDK code from our PL/SQL code, we used one of two approaches:
    (1) use advanced queues to send requests to an external Java program (the CMSDK code, running outside the database) and receive the results back (asynchronous choice); or
    (2) make an HTTP request to a Java servlet (the CMSDK code, running in some Java web container like iAS) and get the response back in some custom format (XML or something) (synchronous choice).
    It seems to me that the CMSDK Java API was designed to be used only in middle-tier, not in database tier.
    Regards,
    Daniel.

  • B1if Call Java Class

    I am attempting to call a java class using the Call Java Class atom. 
    Java Class Name: full name of the java class to be called (boldjar must be available in the B1i base pathbold)
    Where is the B1i base path?
    I have created a simple java class the implements Callable that simply returns 1.
    The exception I get com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: com.sap.b1i.bizprocessor.BizProcException: BPE027 Could not get an instance for 'Callable'-class
    I have pasted the jar file in just about every path I can think of and still get this exception.
    Does anyone have a simple example of what the class should look like?  The callable interface only has a single function named call which does not take parameters.  How do we create a class that accepts parameters?

    Well I found this under Control Center -> Development -> BPC Reference
    User defined Java-Classes for the Call-Atom via the 'Callable' interface
    com.sap.b1i.bizprocessor.Callable
    This interface must be implemented by classes intended to be called by the B1iBizProcessor via the Call-Atom. Instances of these classes are subject of internal pooling if they do not indicate after a usage that they should be destroyed. In order to be able to create them internally in a generic way, they have to implement a parameterless initializer !!!
    I just searched the entire BizStore for com.sap.b1i.bizprocessor.Callable but was unable to find it. 
    I also searched Google for com.sap.b1i.bizprocessor.Callable and it only come up with my posts.
    I also searched the SAP Partner Portal, and SAP SDN with no avail.
    Is this functionality only for internal SAP use?

  • How to call java classes from javascript?

    i have a button which calls javascript i need to access a class to update the values in the database.. how do you call the java code from within the javascript?
    the class is stored under tomcats classes directory and is accessed:
    com.Database.Employee
    the method is called : UpdateEmployeeDetails
    the button
    <input type="button" value="Save" onclick="submitForm('save')" />the javascript
    <script language="javascript">
            function submitForm(process){    
                document.myForm.action="update.jsp";
                document.myForm.submit();
    </script>

    is it not possible?
    do i have to refresh the page and read in the values like...
    <%
    String ename = request.getParameter( "EmployeeName");
         session.setAttribute( "ename", ename);
    %>and then call the class from here?
    looking around ive come across ajax but i dont know how to use it and what you need to install and if its compatable with tomcat and jsp?
    is ajax better or not really worth it?
    i have anything up to 100 fields that need saving at one save click

  • How to write javascript in java class method

    Hi,
    any one please resolved this,
    i want to write javascript window closing code into java class method, in that method i want to write javascript code & wanted to call in jsf page on commandButton action event,
    my code is below but it is not working properly
    public void closeWindowClicked(ActionEvent event) {
              try
         FacesContext facesContext = FacesContext.getCurrentInstance();
         String javaScriptText = "window.close();";
         // Add the Javascript to the rendered page's header for immediate execution
         AddResource addResource = AddResourceFactory.getInstance(facesContext);
         addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);
    catch(Exception e)
         System.out.println(""+e);
    for calling into jsf code is below
    <h:commandButton action="#{parentBean.closeWindowClicked}" value="OK" />
    /*Note- i want to closed the window by caling method contain javascript only, i don't want any ajax code in method */
    please any one can resolved this.
    Thanks

    /*Note- i want to closed the window by caling method contain javascript only, i
    don't want any ajax code in method */ When the user presses your button, do your business logic and then send them to a page containing the following (note: untested code ahead):
    <html>
    <head>
        function onLoadHandler()
            window.close();
    </head>
    <body onload="onLoadHandler();">
        <p>Window closing....</p>
    </body>
    </html>

Maybe you are looking for

  • Adjustment Accounts for GR/IR Clearing

    Hi, I am facing an issue with adjustment for GR/IR Clearing. I have done the config. in OBYP and assigned the relevant G/L accounts to the transaction keys BNG & GNB as under. Recon. a/c : assigned GR/IR clearing account Adjustment a/c: created anoth

  • Can you have two different users with itune accounts on the same computer?

    Can you have two different users with separate itune accounts on the same Ipad?

  • Camera Raw 7 plug-in | Learn Photoshop CS6 | Adobe TV

    NAPP Instructor Matt Kloskowski goes over some of the new changes made to Photoshop's Camera Raw plugin - including the new Process Version 2012. http://adobe.ly/Jo38yo

  • BROKE ROUTER 3600

    Hi Everybody, Thanks for this wonderfull Comunity. My question is... ROUTER 3600, with two serial port E1, p/n: JHY0735K1JS CN1I3DSAAA. It´s started and show it: Apr 16 16:33:58.691: %SYS-5-RELOAD: Reload requested by console. Reload Reason:  Reload

  • 'generic' RGB setting

    What is the difference between the 'generic' RGB setting in the print dialogue box when printing out of InDesign CS5?  I am having a color shift after upgrading from CS2.