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

Similar Messages

  • Simple Java class using SQLJ not compiling.

    Hello all, I have a simple Java class that is using SQLJ. It will not compile though. I am not sure what I should set for classpath. Any ideas? This is what I have so far.
    set PATH=C:\jdk1.2.2\bin;c:\oracle\ora81\jdbc\bin;
    set CLASSPATH="C:\oracle\ora81\jdbc\lib\classes12.zip;C:\oracle\ora81\sqlj\lib\runtime12.zip;C:\oracle\ora81\sqlj\lib\translator.zip;C:\jdk1.2.2\lib\*.*"
    then
    javac SQLJTester.java
    Here is my .java file ---
    import java.io.*;
    import java.sql.*;
    import sqlj.runtime.*;
    import sqlj.runtime.ref.*;
    public class SQLJTester {
    public static void update() throws Exception {
    java.sql.Timestamp timeNow;
    #sql {
    BEGIN
    :timeNow := sysdate;
    END
    public static void main (String[] args) {
    try {
    SQLJTester.update();
    System.out.println ("Updated successfully");
    catch (Exception e) {
    System.out.println ("Caught an exception.");
    Thanks ahead for your time,
    Justin

    When sqlj files are compiled and translted to java file with them the file with extension .ser is also generated. browsers do not recognise this .ser files they only understand .class files which the download using <codebase> instead of class path. so thats why you r not able to use sqlj in servlet. try to customize the profile. Now can some one inform how to use sqlj from eclipse. does it support?. i need to downoad sqlj.exe for that. if anyone has idea from where i can download sqlj.exe pls inform me at [email protected]

  • How do I call a simple java class from a bpel process?

    Hi.
    In JDeveloper 10.1.4.3.0 I've created a simple java class that does an ftp get operation followed by an unzip. The class uses some 3rd part libraries (jars).
    I want to use a simple bpel process to schedule a daily execution of this java class, and deploy it all to our SOA-server, - and was looking into using the <bpelx:exec> function.
    The java class and the bpel process is all stored in the same JDeveloper project.
    How do I put this together so that both my java class and the necessary jars are available to the bpel process?
    I've looked into the JavaExecSample.bpel, and it's says something about "...the class com.otn.samples.javaexec.CreditCalculator is locally packaged with this BPEL process".
    How do I do that?
    Can I make it and test it all locally from my workstation (only JDeveloper installed, I guess there's nothing that can execute the bpel code?), or do I have to compile class etc (make war-file?) and deploy to SOA server (BPEL-INF/lib or classes?) before anything can be tested?
    (I guess all this is simple, once you know how, but being a newbie to this I need a shove in the right direction :-)
    Regards,
    -Haakon-

    To create a java class and dependent jars inside the BPEL process project you need to do the following:
    1. Right click on your BPEL process project and select New and then Java Class from the Items.
    2. Make the BPEL process project, JDeveloper would compile the java classes and add them into the BPEL suite case jar, see the output folder and check the BPEL suite case jar file for java classes and dependent jars.
    You can test your Java classes from JDeveloper IDE, no need to deploy the classes on SOA server. When you make the BPEL project it compiles .bpel files and Java classes. You can test your classes once .bpel file and java classes compiled successfully.
    Regards,
    Dharmendra
    http://soa-howto.blogspot.com

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • Securing Web Services based on simple Java Classes

    Hi @all!
    We`ve got the following problem.
    There`s a .NET client calling our Web services deployed on Bea Weblogic 8.1 (without
    SP).
    The Web Services are generated by the ANT task servicegen. They are based on simple
    Java classes containing the service methods as public members.
    Is there a possibility to secure these methods without using the console menu
    item "Define Security Policy" ?
    We can`t use this menu because it has got a javascript bug with methods returning
    an array.
    Thanks in advance for help.
    Michael

    Hi Michael,
    Could you use transport level security, SSL [1]?
    I'm not sure what limitation you are experiencing with the console? Is
    there a traceback? Have you contacted customer support on this issue?
    Thanks,
    Bruce
    [1]
    http://edocs.bea.com/wls/docs81/webserv/security.html#1053203
    Michael Albrecht wrote:
    >
    Hi @all!
    We`ve got the following problem.
    There`s a .NET client calling our Web services deployed on Bea Weblogic 8.1 (without
    SP).
    The Web Services are generated by the ANT task servicegen. They are based on simple
    Java classes containing the service methods as public members.
    Is there a possibility to secure these methods without using the console menu
    item "Define Security Policy" ?
    We can`t use this menu because it has got a javascript bug with methods returning
    an array.
    Thanks in advance for help.
    Michael

  • How to call JCS in simple java class

    I want to make a atsratup class and this class will have to communicate with a
    java controls.But i am not able to create an instance of java control in simple
    startup class.
    IF any body has called java control in simple java class pls. let me know

    Hi Surinder,
    you can use (some types of) controls with the following code:
    Class controlClass = Class.forName("mypackage.MyControl");
    MyControl control = (MyControl)WlwProxy.create(controlClass, request);
    control.callMethod();
    Unfortunatelly it requires a request (or an URL), so you will need some
    tricks to use it in a startup class.
    This is an internal, undocumneted... call and does not set any
    parameters of the control, so use it with care.
    Let me know if you can solve your problem, pls
    BR,
    don
    surinder wrote:
    I want to make a startup class and this class will have to communicate with a java
    controls.But i am not able to create an instance of java control in simple startup
    class.
    IF any body has called java control in simple java class pls. let me know
    "surinder" <[email protected]> wrote:
    I want to make a atsratup class and this class will have to communicate
    with a
    java controls.But i am not able to create an instance of java control
    in simple
    startup class.
    IF any body has called java control in simple java class pls. let me
    know

  • Web Services - Simple Java Classes

    Hi folks,
    I'm new to using Netweaver and web services in general. I have some existing simple java classes already that I want to convert to a web service. I've decided to try and do a simple test first to make sure I understood how to do this correctly so I followed the steps outlined in this link: (I find I understand this better than the other help files)
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60046fb9-ac5b-2910-08a6-b7b04b463c62">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60046fb9-ac5b-2910-08a6-b7b04b463c62</a>
    In the end what I got was a class file that has been turned into webservices (the code has @WebService, etc). When I try to do a deployment, everything goes well but I'm not quite sure which link I should use to check out my WSDL or anything. I tried the link like in the article above (but used http://localhost:50000 instead) and wound up getting a 404 error. Is there something I'm doing wrong?
    Also, as a quick follow up...since the link shows steps on building EJB's for web services, is it correct to assume that I can use the same steps when building simple java classes? (Create project --> Java Project, create my methods/classes, create new webserive and put slider to Test to check if everything works).
    Any help with this will be greatly appreciated I've been trying to figure this out for days already.

    Hi Bianca,
    Welcome on SDN!
    Have you tried to follow the steps exactly as described in the above document? That is, move the slider to "Develop service", then deploy your application, and request http://localhost:50000/HelloWorldBeanService/HelloWorldBean?wsdl - this worked fine for me.
    > I find I understand this better than the other help files
    Well, which help files you use depends on which version of the NetWeaver AS Java you're using. The link above is applicable to the Java EE 5 preview version; the help files you're probably referencing are the official documentation of the NetWeaver 04 and 04s releases.
    Hope it helps!
    -Vladimir

  • How to pass a HTTP request from a simple java class

    Is it possible to pass an HTTP request from a simple java class.if yes how?

    Is it possible to pass an HTTP request from a simple
    java class.if yes how?If you're talking about creating a HttpRequest object and passing it to a servlet, that would be a red flag to me that your design is flawed. You shouldn't have to do that - the application server (Tomcat, Weblogic, etc) should be the only thing that has to worry about creating that kind of object and passing it to you.

  • How to Run a .sql file from simple java class

    How to execute a .sql file consisting of Complex Queries,procedures through simple java class.
    The queries may have different delimiters,queries independant of each other.
    I am able to do with Specific De-limiter.But I need in such a way that there should not be any
    Constraints. Since My .sql may Contain different De-limiters.
    If any one can Suggest Some Solution.
    It will be Great Help.
    regards
    Anil

    Check out ibatis script runner, it' a third party library but quite handy for running sql files...
    m

  • Can we run the batch file using simple java application

    Hello sir,
    we want to run the batch file using simple java application. i tried with some example, we run the exe files but not batch file.
    Runtime r = Runtime.getRuntime();
    r.exec("D:\\jboss\\bin\\run.bat");
    My application is server will run when we run the java appliation.
    any suggestion? plz give me the solutions

    yes you can run html file
    WEB.SHOW_DOCUMENT is a built-in that is used in Forms to call URL from a Web Form. It works much like the similar way that a link on an HTML page works and it takes two arguments, one is URL and second one is TARGET, in your case use following.
    WEB.SHOW_DOCUMENT('http://channas.iil.informatics.lk:8890/forms/frmservlet?config=abc.html', '_blank');
    Hope this will work for you
    Abbas

  • How to create java classes when multiple xsd files with same root element

    Hi,
    I got below error
    12/08/09 16:26:38 BST: [ERROR] Error while parsing schema(s).Location []. 'resultClass' is already defined
    12/08/09 16:26:38 BST: [ERROR] Error while parsing schema(s).Location []. (related to above error) the first definition appears here
    12/08/09 16:26:38 BST: Build errors for viafrance; org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.1:generate': Mojo execution failed.
    I tried genarate java classes from multiple xsd files, but getting above error, here in .xsd file i have the <xe: element="resultClass"> in all .xsd files.
    So I removed all .xsd files accept one, now genarated java classes correctly. but i want to genarte the java classes with diffrent names with out changing .xsd
    Can you please tell me any one how to resolve this one......
    regards
    prasad.nadendla

    Gregory:
    If you want to upload several Java classes in one script the solution is .sql file, for example:
    set define ?
    create or replace and compile java source named "my.Sleep" as
    package my;
    import java.lang.Thread;
    public class Sleep {
    public static void main(String []args) throws java.lang.InterruptedException {
    if (args != null && args.length>0) {
    int s = Integer.parseInt(args[0]);
    Thread.sleep(s*1000);
    } else
    Thread.sleep(1000);
    create or replace and compile java source named "my.App" as
    package my;
    public class App {
    public static void main(String []args) throws java.lang.InterruptedException {
    System.out.println(args[0]);
    exit
    Then the .sql file can be parsed using the SQLPlus, JDeveloper or SQLDeveloper tools.
    HTH, Marcelo.

  • Referencing utility classes from a war file

    How do you reference a utility class from a war file? I tried adding the class to the deployment plan descriptor, however I still get a ClassNotFoundException.
    Thanks,
    Will

    To use the utility classes from a war you have to place them under the web-inf/classes directory.
    webApplication(WAR directory)--->WEB-INF--> classes (put your utility classes in this directory)

  • 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

  • Simple Java classes (POJO) used to generate EJB3 session

    Hi there,
    Since relationships between entity beans are not displayed in a EJB3 diagram, I would like to make a regular Java classes diagram (with regular classes) and then manually add annotations to these classes to make persistent (eg. add @Entity....). Then I would like to generate session beans which could use this simple classes as entity but this does not work : JDev only sees entity beans which were created as 'Entity beans from the menu'...
    Any idea?
    Thanks,
    Fabrice.

    Just found a solution: I edited the JDev project file (model.jpr in my case) and add the following line inside the <list n="annotatedEjbBeanClassUrls"> tag:
    <url path="src/testejb3/model/Class1.java"/>
    If works but that's not a wonderful solution. If someone has a solution which works from the IDE then I am still interested ;-)
    Regards,
    Fabrice.

  • Simple java class for SQL like table?

    Dear Experts,
    I'm hoping that the java people here at the Oracle forums will be able to help me.
    I've worked with Oracle and SQL since the 90s.
    Lately, I'm learning java and doing a little project in my spare time. 
    It's stand alone on the desktop.
    The program does not connect to any database 
    (and a database is not an option).
    Currently, I'm working on a module for AI and decision making.
    I like the idea of a table in memory.
    Table/data structure with Row and columns.
    And the functionality of:
    Select, insert, update, delete.
    I've been looking at the AbstractTableModel.
    Some of the best examples I've found online (they actually compile and work) are:
    http://www.java2s.com/Code/Java/Swing-JFC/extendsAbstractTableModeltocreatecustommodel.htm
    http://tutiez.com/simple-jtable-example-using-abstracttablemodel.html
    Although they are rather confusing.
    In all the examples I find, there always seems to be
    at least three layers of objects:
    Data object (full of get/set methods)
    AbstractTableModel
    GUI (JFrame, JTable) (GUI aspect I don't need or want)
    In all the cases I've seen online, I have yet to see an example
    that has the equivalent of Delete or Insert.
    Just like in SQL, I want to define a table with columns.
    Insert some rows. Update. Select. Delete.
    Question:
    Is there a better java class to work with?
    Better, in terms of simpler.
    And, being able to do all the basic SQL like functions.
    Thanks a lot!

    Hi Timo,
    Thanks. yes I had gone thru the java doc already and  they have mentioned to use java.sql.Struct, but the code which got generated calls constructor of oracle.jpub.runtime.MutableStruct where it expects oracle.sql.STRUCT and not the java.sql.STRUCT and no other constructor available to call the new implementation and that is the reason i sought for some clues.
      protected ORAData create(CmnAxnRecT o, Datum d, int sqlType) throws SQLException
        if (d == null) return null;
        if (o == null) o = new CmnAxnRecT();
        o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
        return o;
    here CmnAxnRecT is the class name of the generated java class for sqlType.
    Thanks again. Please let me know if you have any more clues.
    Regards,
    Vinothgan AS

Maybe you are looking for

  • File Browse "no file selected"

    Hi, Sorry if this has been asked before. I've created a form, part of that form uploads a file and this works fine but i'm using the same page to edit those details. When the page is opened the all the values apart from the file browse diplay OK, thi

  • 16:30:24 BTC 007 000 SAPSYS            D01 Transaction Canceled BT 510 ( )

    dear all we are getting this error in xi server  please help 16:30:00 DIA 002 000 SAPSYS            GC3 The active profile was modified 16:30:00 DIA 002 000 SAPSYS            GC4 >>> Profile name = D:\usr\sap\XID\SYS\profile\XID_DVEBMGS35_XIDSVR 16:3

  • Adapter file Receive - conversion file problem

    Hi everybody, In an adapter file receiver, I want to convert an XML structure to a "flat file". here is my xml structure <ns1:MT006_blabka>   <RECORD>     <LIGNE>TEST1</LIGNE>     <LIGNE>TEST2</LIGNE>   </RECORD>   <FILE>      <FILENAME>fichier.dat</

  • Mainstage 2 Concert won't open, stuck on EXS

    My concert I've used forever suddenly won't open. Hangs on loading EXS. What has Apple done to **** up Mainstage 2 so horribly??? CPU usage way worse, less stable, less reliable. It's a joke, and not a funny one. Logic upgrade was a HUGE waste of mon

  • History tracking in hrms

    Hi experts i am looking for a profile option to enable me to track the changes (a history, was has been done so far). Looking for any response. Thanks