Calling a java class in a JSP file

Hello,
I have a jsp file in which I call a java class.
I work with Tomcat 4.0.1
If I modify the java class and then I execute my JSP, it still be the old version of my class that is executed.
I don't understand why since if I creates a main function and I execute it, it works correctly!
Do you know what is the problem?
Thanks

i also have this problem.when i modify jsp file,it didn't execute inmediately. Then i restart tomcat,but problem also exist.
a few minute age,i execute jsp file again,it can appear the modified jsp.i don't down why
i work tomcat 5.0 windowxp

Similar Messages

  • How to call a java class in a bat file

    Hi
    I need to call a Test.java class in a bat files .It refer .DOM.jar
    in C:/url; How do i call the java class i need the syntax
    Thanks lot

    assuming lanch.bat, Test.class and DOM.jar are in c:\url
    assuming %JAVA_HOME% is defined (else substitue it with your java installation directory)
    here is the content of launch.bat:
    cd C:/url (or cd c:\url ) (or cd c: followed by cd url)
    %JAVA_HOME%\bin java -classpath .;DOM.jar Test
    hop that'd help,
    marvinrouge

  • Unable to import a java class in a jsp file

    Hi,
    I am trying to import a java class in my jsp.
    ------------------jsp---------------
    <jsp:useBean id="form" class="com.company.portlets.searchApps.object.SearchOBJ" scope="request" />
    <jsp:setProperty name="form" property="*" />
    <input type="TEXT" name="projectID" value='<%= form.getProjectID() %>'>
    When I run the above JSP, it says that class 'com.company.portlets.searchApps.object.SearchOBJ' cannot be found.
    Why?
    My project structure looks like this:
    Project
    +Application Sources
    ++com.company.portlets.searchApps.object
    +++SearchOBJ.java
    +Web Content
    ++htdocs
    +++searchappsportlet
    ++++SearchAppsPortletShowPage.jsp
    ++WEB-INF
    +++index.jsp
    +Resources
    ++SearchApps.deploy
    Please advice...thanks!

    The way that JDeveloper organized the files was like this:
    C:\jdev1012\jdev\mywork\WksSearchApps\Project\classes\com\company\portlets\searchAPPS\object\SearchOBJ.class
    I am assuming that JDeveloper puts the file where they are suppose to be...if not, how do I change that?
    thanks,
    hussain

  • Invoking a method from a java class to a jsp file

    Maybe i'm going through a very basic error, but as i've looked for in some forums and nothing found decided to post. So let's go to the problem.
    Well, i have a form in a jsp file, it's basicaly html, but as i need some select boxes populated with data from the database i decided to create some methods in java classes. This is the point.
    My method receive some attributes, like the table and colums names, the name of the select box and the HttpServletResponse object.
    So after making all the database process. The method is supposed to write the result through the out.println(); object
    It goes everything all right except that the method seems to be called first than the html code coz' my select boxes comes above the head in the begin of the page and was supposed to come in the middle.
    part of the code:
    package pacote;
    import java.packages.*
    public class Class{
    public void metodo(HttpServletResponse response, String tableName, String column name, String selectName){
    PrintWriter out = response.getWriter();
    openConnection();
    //After making the query stuff
    //caso n�o haja nada na consulta
         if(rst == null)
         out.println("N�o h� registros.");
         else{
         out.println( "<select name='" +SelectName + "' id='" +SelectName + "' class=\"input_ob\" >");
         out.println( "<option value=''>Escolha: "+objeto+"</option>");
         //fill the select body with options; A while that sweap the resultSet and use the out object to write the results          
         getSelectBody(out,rst, selectValue);
    }This method is called this way:
    <tr valign="baseline">
        <td nowrap align="right">Grupo</td>
        <jsp:useBean id="m" scope="page" class="pacote.Class" />
            <td>
              <%
              try{
                   m.metodo(response, "tabela","grupo","id_grupo);
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                        %></td>I'd like to know what i'm missing here. why the answer doesn't go in the place It's supposed to go.
    any answer will be greatly apreciated

    The issue is caused because you are using the response to get the writer directly.
    The JSP has gotten the same writer, but has wrapped it in a JSPWriter class. That class has got a buffer.
    So it writes the beginning html to the JSPWriter buffer.
    You write your stuff to the response writer - gets sent to the output.
    It writes more stuff to the JSPWriter buffer, then flushes that buffer - at which point all the text written into the JSP writer now gets added to the response.
    You see how your code is coming out first?
    Solution - instead of getting the writer from the response, pass the writer into your method (maybe instead of response if you don't use response for anything else)
    public void metodo(Writer jspWriter, String tableName, String column name, String selectName){
      PrintWriter out = new PrintWriter(jspWriter);
      ...That means that you will be writing to the same writer, and the text should come out in sequence.
    Cheers,
    evnafets

  • Calling a java bean in a jsp file

    hi all
    i am working on a jsp project. my tomcat is installed on one machine and my java Bean on another. how do i call the javabean on my machine from the jsp file on tomcat. i'm using packages.
    eg:
    in the jsp file in tomcat, i'm using
    <jsp:useBean id="student" scope="request" class="lab3.Student"/>
    i get class not found error.
    my main path for this Student Bean is say c://myLab/lab3 which has a lab3 folder with class files.
    Thanks

    eg:
    in the jsp file in tomcat, i'm using
    <jsp:useBean id="student" scope="request"
    class="lab3.Student"/>
    If you have a Context defined for c://mylab
    then below that directory you should have a WEB-INF directory and then a classes directory and then within that your package structure...
    so if the package is lab3 yo should have your Student class in:
    c://mylab/WEB_INF/classes/lab3/Student.class
    (asuming you have set up a Context that points at c://mylab...and your jsp file is there...)

  • Can't find the imported java class when run .jsp file

    Hi,
    I want to run a jsp web application using tomcat. I put all my .jsp files under "TOMCAT_HOME/webapps/junmin" directory, and put all .class files under "TOMCAT_HOME/webapps/junmin/WEB-INF/classes" directory. I set up TOMCAT_HOME AND JAVA_HOME already. But when I type in the address like below:
    http://db1.acad.emich.edu:8080/junmin/login.jsp
    The IE will give me error msg indicating that it can't find all the .class files which I imported them in login.jsp file.
    So, does anyone know that if I miss some configuration in order to let the .jsp file recognize the .class files. Thanks a lot!
    Sincerely, Junmin

    Ha, this might be the reason.
    Can I add sth like this:
    <Context path="/junmin" docbase="junmin" debug=0 reloadable=true>
    </Context>
    But in my local computer, I didn't add this <Context> either. It works well.
    Thanks a lot! I will ask the administrator to try this.
    And will write down the reason.
    Sincerely, Junmin

  • Calling a java class in JSP in Weblogic 5.1

    Hi
    I am trying to call a java class in a jsp page. But it is giving an error:
    Compilation of 'C:\weblogic\myserver\classfiles\jsp_servlet\_knet\_buy.java' failed:
    C:\weblogic\myserver\classfiles\jsp_servlet\_knet\_buy.java:79: cannot access jsp_servlet._knet.e24PaymentPipe
    probably occurred due to an error in /knet/buy.jsp line 25:
    e24PaymentPipe pipe = new e24PaymentPipe();
    Is this a problem bcos of the wrong path of the class file which i am calling?
    Please help this is urgent

    Hello All
    As I tried to deploy the easiest project (dummy.war) on WebLogic 8.1.5, There is only one class (without package) Login.class
    *********** Listing of the dummy WAR ***********
    META-INF/
    META-INF/MANIFEST.MF
    WEB-INF/
    WEB-INF/classes/
    WEB-INF/classes/Login.class
    WEB-INF/web.xml
    index.jsp
    login.jsp
    ************ Output of deployment from Admin Console****************
    Log:     
         A log of the task's activities.
    [Deployer:149033]preparing application dummy on intranetAdmin
    [Deployer:149033]prepared application dummy on intranetAdmin
    [Deployer:149033]activating application dummy on intranetAdmin
    [Deployer:149033]failed application dummy on intranetAdmin
    [Deployer:149034]An exception occurred for task [Deployer:149026]
    Deploy application dummy on intranetAdmin.:
    Exception:weblogic.management.ApplicationException: start() failed.
    Module: dummy Error: weblogic.management.DeploymentException:
    [HTTP:101216]Servlet: "index" failed to preload on startup in Web application:
    " dummy ".
    weblogic.servlet.jsp.CompilationException: Compilation of D:\apps\wlsapp\
    INTRAN~1\.\intranetAdmin\.wlnotdelete\extract\intranetAdmin_ dummy _ dummy
    \jsp_servlet\__index.java failed.
    D:\apps\wlsapp\INTRAN~1\.\intranetAdmin\.wlnotdelete\extract\
    intranetAdmin_dummy_dummy\jsp_servlet\__index.java:22: '.' expected
    import Login; //[ /login.jsp; Line: 8]
    ^
    1 error
    at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:478)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:246)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:196)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.
    java:3430)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.
    java:3387)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext
    .java:3373)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3356)
    at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:
    6208)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:864)
    at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2134)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2175)
    at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
    activateContainer(SlaveDeployer.java:2520)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer
    .java:2438)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2155)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2254)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2149)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.
    java:2401)
    at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:
    883)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:591)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500)
    at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    Caused by: java.io.IOException: Compiler failed executable.exec
    at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:470)
    at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:328)
    at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:336)
    at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:321)
    at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:451)
    ... 22 more
    - with nested exception:
    [java.io.IOException: Compiler failed executable.exec]
    I put this class into a dummy package named sample, changed package declaration within this class and changed import statement within jsp pages like this :
    <%@ page import="sample.Login " %>
    <jsp:useBean id="logUsr" scope="session" class="sample.Login" />
    When I did like this, everything is ok. No more exception.
    If my application has so many java classes under WEB-INF/classes/ without creating package, it may be so inconvenience.
    Please kindly let me know why this exception (class not found exception) occurred.
    And what is the solution? I cannot deploy the application successfully yet.
    many thanks,
    Zin Ko Win

  • Calling my Java class from JSP page

    Hello, I am trying to call my Java class from my JSP page passing parameters to it and getting back a collection of result sets. Can someone tell me what I might be doing wrong:
    JSP code to call Java class:
    <%
    String strEssUser = "test";
    String strProcessingMonth = "JUL";
    String strProcessingYear = "2002";
    strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
    %>
    I get this error when I try to run this JSP page using tomcat:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:77: Class org.apache.jsp.ListReturn not found.
    strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
    I'm not sure if this problem is the way I am calling the Java class, or if I have a problem in the Java code itself. Can anyone help?

    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?

  • Re: Using simple java class in an .war file.

    Hi All,
    I have a simple question,
    Can I access an simple java class from a jsp file that I have written by putting it in the "classes" folder?? What entry should go in the web.xml file?
    Here is my directory structure:
    sample.war
    |
    ----test.jsp <file>
    |
    ----WEB-INF <folder>
    | |
    | ----classes<folder>
    | | |
    | | ----simpleJavaClass.class<file>
    | |
    | ----lib<folder>
    | |
    | ----web.xml
    I want to access the simpleJavaClass.class from the jsp test.jsp.
    Please suggest.
    Thanks and regards
    Ayusman

    It is possible to access the class in u r classes folder from u r jsp file.
    For example
    <%@ page import="com.test.service.PricingSolution,
    com.test.core.PhoneNumber
    %>
    <% PricingSolution solution = (PricingSolution)session.getAttribute("solution"); %>
    This is a simple scriplet example. You do the same using jstl tags also.
    --Shinoy

  • Jsp session variable to call in  java class.

    here i am facing a problem in calling a jsp session varibale to java class.
    in my code.. i have seperate files for jsp pages and packaged java classes.
    as i am developing a web tire application. the data entered in the front end i am getting to jsp page and putting the mandatory in session to use in other pages. now here the same session vaiable i have to use/call in java class file.
    Please refer me the best method and any references on this to call the session vaiable to java class file.
    in jsp page i decleared like this:
    session.setAttribute("stuIdentification",stuid);
    this id i have to use in java class.file.
    how to call it?
    Thanks
    Kurra

    Gimbal2's got the right idea.
    The reasons for choosing point 1) are also valid. Whenever possible try and do as much code that is not specifically tied to your business objects inside your dynamic element (the jsp page) instead of your static one (the compiled class)
    this allows you to very easily update your jsp to make any changes without having to recompile class code. Recompiling seems like a little thing when you are in development but imagine if the class is executed by a business critical application that faces forward to customers, recompiling will mean shutting down your servers and that may not be an option.
    Regards,
    David

  • Java.lang.NoClassDefFoundError while calling a java class from BPEL

    Hi,
    I'm calling a java class to convert JSON to XML using BPEL. I have imported all the necessary jar files in the project and compiling done successfully.
    But at runtime , i get the java.lang.NoClassDefFoundError: net/sf/json/JSON error.
    For this i placed all the necessary jars under FUSION_HOME/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/ path and restarted the server.
    But still i'm getting the same error at runtime.
    Did i missed any step? Let me know the procedure to solve this.
    Do i have to run ant or edit Manifest file after placing the jar?
    in one site i find we have to place the jars under <DOMAIN HOME>/lib directory. Is this correct?
    We are using SOA suite 11.1.1.6.
    Thanks,
    Terry

    Hi Karan,
    I have done placing the jars at FUSION_HOME/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/ and ran ant  -f build.xml .The build was successful without any error.
    I have even placed the jars in <DOMAIN HOME>/lib (/us2001/fmw/11.1.1.6/user_projects/domains/ohsdomain/lib) and did a server restart.
    After these activities, when i execute the composite, i still get the error in em console,
    Message
    got RuntimeException
    Supplemental Detail
    oracle.fabric.common.FabricException: Could not create object of class 'packageName.className'; nested exception is:
    java.lang.NoClassDefFoundError: net/sf/json/JSON
    at oracle.integration.platform.blocks.wsif.WsifReference.request(WsifReference.java:698)
    at oracle.integration.platform.blocks.mesh.SynchronousMessageHandler.doRequest(SynchronousMessageHandler.java:139)
    at oracle.integration.platform.blocks.mesh.MessageRouter.request(MessageRouter.java:182)
    Any help on this.
    Thanks,
    Terry

  • Calling a Java Class from PL/SQL

    Hai,
    I need a technique of calling a class file and invoke its
    methods written in Java by PL/SQL for my intranet development.
    PLease let me know if you have really experienced and won.
    Thanks
    JOhnson

    First, to call a Java class from PL/SQL the class needs to be
    deployed to the database. you can check the 8i documentation for
    the instructions for loading Java into the database(LoadJava).
    The document contains information on how to load the Java and
    call it from PL/SQL. The following links should help.
    Loading Java:
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
    java.817/a83728/03write6.htm
    Invoking a Java Method in the database:
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
    java.817/a83728/04jserv2.htm
    Gary (JDev Team)

  • I want to call External Java class from the PL/SQL

    Hi,
    I am using Oracle Apps R11i (11.5.7), I wanted to call external Java class from the PL/SQL. This external Java class is residing in another application server.
    How do I do this.
    I know one way. Develop C routine in Oracle Apps to call external java class and call this C routine from the PL/SQL.
    Is there any simple method available? or any other method?
    Thanks in advance.
    -Venkat

    First of all, this is a Java application you're talking about, right (i.e. it has a main() function)? It's not just a class that you're trying to instantiate is it? If it's an application, you obviously have to start a new virtual machine to run it (rather than using the virtual machine built into the database like stored java). I'm a little leary of your mention of an "application server" as this would more commonly mean that a virtual machine is already over there running with access to this class. In which case, you'd typically interface with SOAP or some other RPC API.
    All that aside, as long as you have physical disc access (through NFS or whatever) to the class file, you could use a java wrapper class with a system call to do this. In fact, there is a thread in just the last day or so on this very forum that has the code to do just that (see " Invoking OS Commands from PL/SQL"). However, it's worth noting that the virtual machine will be running on the database server in this case and not the application server.

  • 11g iBots(Agents) calling custom java class?

    We upgraded from 10g to 11g and we have iBots that call a custom java class in the form of a jar file.
    This all worked fine in 10g.
    I followed all configuration steps in the documentation, but we are unable to get our iBots(Agents) to work in 11g.
    Keep getting "Can't find Class" errors.
    Has anyone successfully created agents that call custom java classes with 11g, if so, can you please share your steps for doing this?

    Hi glova,
    The document refers to the RPD and catalog migration....what ever customization used in 10g wont effect in 11g i suppose most of the things.
    i would suggest you to copy the java class of ibots and do the copy paste or manually do it in 11g and see if it works ...this is the only alternative.
    hope helps you.
    Cheers,
    KK

  • How to: Calling a java class from asp?

    Hello all i have a problem to call a Java class from a asp
    Here what I do:
    [JavaSays.java]
    package JavaCom;
    public class JavaSays
    public String Hello()
    return "Hello world" ;
    then
    javareg /register /class:JavaCom.JavaSays /progid:JavaCom.JavaSays
    md c:\winnt\Java\TrustLib\JavaCom
    copy JavaSays.class c:\winnt\Java\TrustLib\JavaCom
    --Asp
    --TestJavaCom.asp
    <html>
    <body>
    <h1>Simple Test</h1>
    <% Set ObjPrueba = Server.CreateObject("JavaCom.JavaSays") %>
    <%= ObjPrueba.SimpleFn(5) %>
    <hr>
    </body>
    </html>
    when i try to run my asp
    it tell me that:
    Error type : Server Objetc, ASP 0177 (0x80040111)
    ClassFactory can not find the class
    any idea???
    thanks.

    I think the OP wants to use a class file as a COM object. I've never done that, but this URL:
    http://support.microsoft.com/default.aspx?scid=KB;EN-US;q167941&
    seems to indicate that you should have placed the class file into the c:\winnt\Java\TrustLib\ sub directory before you ran the JAvaReg bat file - I would re-run JavaReg and bounce IIS and associated services and see if that works out.
    Good Luck
    Lee

Maybe you are looking for

  • How to make a new recovery partition on a 600 series

    Well I thought this was worth a mention as nobody seems to have said it could be done. Having just got the cheep 600 series unit working I wanted to restore the RESTORE PARTITION. Mostly to get the F11 function working as it should after fitting a Br

  • Windows 7 automatic login to AD and Edir

    Any one have clear instructions on how to accomplish automatic login to a windows AD domain and edirectory? Using Novell Client 2 Sp3 for windows 7 (IR6). Novell is the primary login. Goal is to enable the automatic login to both as user "install" ..

  • Imac 24" connecting to a ibook

    hey, i was thinking of getting a imac 24". would the built-in airport let me share my internet connection to my ibook g3 if i plug my broadband into the imac? thanks, JC

  • Creating Query for deatils of theVendor Sub Range

    Dear All I am in IS RETAIL( ECC 6.0) project and are using Vendor Sub Range Scenario.A requirement has come to create a Query for the Below Fields for a specific Vendor 'S say iMPORTVENDORS..  May i know from which tables we can extract and if possib

  • Labview error GPIB controller not adressed correctly

    I get this Labview error: GPIB controller not adressed correctly (LV5.1, win NT4) when i try to send data to a HP4275A LCR meter. How ever it works on an older system running with LabView 5.0 (also NT)!!! How can I get rid of this problem????