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);

Similar Messages

  • 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

  • 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.

  • 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

  • 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..

  • 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.

  • 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?

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • Is it possible to call a class method using pattern in ABAP editor.

    Hi,
         Is it possible to call a class method using pattern in ABAP editor.
    Thank U for Ur time.
    Cheers,
    Sam

    Yes,
    Click patterns.
    Then choose Abap objects patterns.
    Click on the Tick
    It will give a new screen
    Here Give the name of the class first.
    Then the object (instance of the calss)
    And finally the method ..
    it will give you the pattern
    Hope this helps.

  • 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.

  • Import java class that uses DbConnection

    How to import java class that uses DbConnection? I don't want to write my own PluginDataSource.
    It is possible to get Connection in imported java classes?

    This is not possible. Even connection used by individual PDS are only limited to those individaul PDS only and are not shared across them.
    Thanks
    Rohit

  • Problem accessing servlet from java class which uses Basic Authentication

    "Hi,
    I am using weblogic 6.1 server. I am calling a servlet file from a class file using HttpURLConnection. This is the code below.
              String theUsername="B1A1Z1T2";
              String thePassword="hlladmin";
              String urlString="http://rsnetserver:113/hll/servlet/CallSSRUpload";
              String userPassword = theUsername ":" thePassword;
              String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
              try
                   URL url = new URL (urlString);
                   HttpURLConnection uc=(HttpURLConnection)url.openConnection();
                   int it = 0;
                   while ((it = encoding.indexOf('\n')) != -1
                        || (it = encoding.indexOf('\r')) != -1) {
                             encoding = encoding.substring(0, it)
                             encoding.substring(it 1);
                   uc.setRequestProperty("Authorization","BASIC " encoding);
                   uc.setRequestProperty("SOAPAction", url.toString());
                   System.out.println(uc.getResponseCode());
                   System.out.println(uc.getResponseMessage());
              catch(Exception io)
                   io.printStackTrace();
                   System.out.println("error message........" io.getMessage());     
    In web.xml I have d

    Hello,
    Could you post the stack trace?
    Thanks,
    Bruce
    Vijay Babu wrote:
    >
    "Hi,
    I am using weblogic 6.1 server. I am calling a servlet file from a class file using HttpURLConnection. This is the code below.
    String theUsername="B1A1Z1T2";
    String thePassword="hlladmin";
    String urlString="http://rsnetserver:113/hll/servlet/CallSSRUpload";
    String userPassword = theUsername ":" thePassword;
    String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
    try
    URL url = new URL (urlString);
    HttpURLConnection uc=(HttpURLConnection)url.openConnection();
    int it = 0;
    while ((it = encoding.indexOf('\n')) != -1
    || (it = encoding.indexOf('\r')) != -1) {
    encoding = encoding.substring(0, it)
    encoding.substring(it 1);
    uc.setRequestProperty("Authorization","BASIC " encoding);
    uc.setRequestProperty("SOAPAction", url.toString());
    System.out.println(uc.getResponseCode());
    System.out.println(uc.getResponseMessage());
    catch(Exception io)
    io.printStackTrace();
    System.out.println("error message........" io.getMessage());
    In web.xml I have d

Maybe you are looking for

  • Creative cloud

    Creative cloud icon is in the status bar, but nothing is happening?

  • MM Period opening

    Why do I need to close the previous period for opening new period. 1. Currently I have a situation where we require both the periods to be opened at a same time. for example,  our account closing of Fin Year 2011 has not yet closed due to posting of

  • How do let Appel know that I have a new debit card

    II'm not able to charge products through Apple today because I have a new Debit card.  How do I let apple know about my new card# thank you

  • Getting data from some source and insert into corresponding source

    hi all, i am using db10g. i have like like MMA : add1:add2:add3'the above said is the format and actual data will be something like MMA : bank street : no:32 : tel: +9127546663 add1 = bank street add2 = no:32 add3 = tel: +9127546663 my requirement to

  • GRC AC 10 - batch risk analysis does not bring results

    Hi all,           When I perform a batch RA the job ends quickly and bring no results. It takes like a sec per user. I am running it from rules that became from a Logical group. When I upload the rules to a physical system it brings results. What can