JBoss with regular Java class

Can I use JBoss with a regular Java class? If no... which's the best way to make this?

Yes.
You'll have to read the JBoss documentation to find out where you need to place the regular Java class. Once you have done so, you can...
<%@ page import="com.carnargos.packages.*" %>
<html>
<body>
<%
      HelloWorld hw = new HelloWorld( );
%>
<%= hw.getGreetings( ); %>
</body>
</html>

Similar Messages

  • JSP page access regular Java class

    I am new to JSP. But most of the time people say JSP page access Java Bean classes.
    I want to know what if I want to access regular Java classes?? Should I do like this
    in the code:
    <%
         NormalJavaClass cl = new NormalJavaClass();
         cl.process();
    %>
    <%-- JSP page access Java Bean -- %>
    <jsp:useBean scope="session" id="formDataBeanObj" class="formdatatest.FormDataBean"/>
    <jsp:setProperty name="formDataBeanObj" property="*"/>
    <HTML>
    <HEAD>
    <TITLE>page1.jsp</TITLE>
    <BODY>
    <FORM METHOD="POST" ACTION="page2.jsp">
         <H2>User Name = <jsp:getProperty name="formDataBeanObj" property="username"/></H2>
    <%
         NormalJavaClass cl = new NormalJavaClass();
         cl.process();
    %>
    <P><INPUT TYPE="SUBMIT" VALUE="submit here">
    </FORM>
    </BODY>
    </HTML>
    Please advise. Thanks!!

    Yes, you can instantiate and reference any class visible to the Java runtime from within a JSP just as you can in an "ordinary" Java class. Behind the scenes, a JSP is converted into Java source code for a servlet class, and then compiled into the .class file. When you insert code into JSPs using either taglibs or code delimiters (<% %>, <%= %>), the JSP/servlet "engine" inserts this code into the servlet source code verbatim, and all non-Java text from the JSP is inserted into the source code inside of JspWriter.write(xxx) statements.
    If you'd like to see the source code that your JSP is converted into, run your JSP in Tomcat and look in the "work" folder within the Tomcat folder after you access it the first time. Experiment around with the JSP and see how code within the <% %> and <%= %> blocks is inserted into the .java file.

  • Implementing DOM Interface with existing Java classes

    I had planned on using some tree-like Java classes as a Document Object Model, which would give me access to all sorts of XML and DOM tools like parsers and XSLT transformers. Initially, I thought all that would be neccessary is to implement all the DOM Interfaces in org.w3c.dom and then I would have a set of classes that conformed to DOM Level 1. It was my understanding that interfaces such as DOMImplementation and Document would interface with various XML tools, allowing creation of a class that implements Document and then Document would have its various factory methods that know how to create the various DOM nodes such as Element, Attr, Text, NamedNodeMap, NodeList, etc.
    The problem I'm seeing now is that the JAXP specification (which is what the latest Xerces and Xalan tools conform to) has something called a DocumentBuilder and DocumentBuilderFactory that appear to be necessary to tell the framework what type of class to instantiate that implements the Document DOM interface. Those appear to have a lot of methods that deal with parsing of XML documents and I didn't really want to write or even subclass any existing Parsers in order to get the functionality of traversing and transforming a set of classes that implement the DOM interface.
    Am I missing something here? Is it possible to plug in any (set of classes for) DOMImplementation and get them to work with the various DOM and XML tools out there?
    Is there an easier way to allow parts of an application access to internal data structures but have the more generic tools or APIs, such as XSL transformers, access that same set of classes as a DOM with the generic DOM interface methods?
    Can someone provide me with some guidance here? I'm in the process of finalizing some design on a system and need to know if this is possible or if I need to alter my design.
    Thanks.

    If I understand you correctly, I think I am working on a similar issue. I am unhappy with the methods given by the DOM for retrieving data from the XML file and for building a file. Our software has a bunch of code that uses these classes and it is extremely ugly. My solution was to create a facade on top of the DOM model. Essentially I have some simple classes that store all the pertinent info (for me) about the XML structure. Essentially that is the element or attribute name, its values and in the case of the element, it's children. This makes it easier for me to build and retreive the data. What I then built was a loader class and a builder class. The loader takes an XML file and parses it in using the DOM classes and builds a structure using my classes and returns the root element. The builder takes a root element and creates a DOM object out of it. This frees me of having to code around the DOM classes all over the place and makes it simple to upgrade our XML code if the DOM changes or a better DOM is released. I am using factories to facilitate this and allow me to have loaders for specific types of XML documents so that I can have a class for each which further simplifies the XML related tasks of other developers on my team.

  • Using a regular JAVA class (not java bean)

    I have a regular class which I have created & I want to use in a JSP Page.
    How can I import it?

    Put a JSP import on the top of your page
    <%@ page import="yourclassname" %>
    Post JSP questions in this forum
    http://forum.java.sun.com/forum.jsp?forum=45
    Thanks

  • What is wrong with this Java class and method?

    Created a managed bean and following method as shown below.
    public void setEvent(DisclosureEvent disclosureEvent, CoreShowDetail detail) {
    if (disclosureEvent.isExpanded()) {
    detail.setDisclosed(!detail.isDisclosed());
    -- Then integrated above in the following jspx.
    <af:showOnePanel inlineStyle="width:400px;height:300px;"
    binding="#{ShowApanel.showOnePanel1}"
    id="showOnePanel1">
    <af:showDetailItem text="ADF Faces Components"
    binding="#{ShowApanel.showDetailItem3}"
    id="showDetailItem3" disclosureListener="#{ShowApanel.setEvent}">
    <af:panelHeader text="ADF Faces Components First Child"
    binding="#{ShowApanel.panelHeader6}"
    id="panelHeader6"/>
    <af:panelHeader text="ADF Faces Components Second Child"
    binding="#{ShowApanel.panelHeader5}"
    id="panelHeader5"/>
    </af:showDetailItem>
    <af:showDetailItem text="Architecture"
    binding="#{ShowApanel.showDetailItem2}"
    id="showDetailItem2"
    disclosureListener="#{ShowApanel.setEvent}">
    <af:panelHeader text="Architecture First Child"
    binding="#{ShowApanel.panelHeader4}"
    id="panelHeader4"/>
    <af:panelHeader text="Architecture Second Child"
    binding="#{ShowApanel.panelHeader3}"
    id="panelHeader3"/>
    </af:showDetailItem>
    </af:showOnePanel>
    THE ISSUE:[b]
    I am still not able to programmatically disclose or undisclose the panel component.
    Where am I going wrong? Please help.
    Thanks,
    Ruchir

    Hello Frank,
    I put several print statments but none of them is executing on browser. Does this mean that the method is not being called even once?
    public void setEvent(DisclosureEvent disclosureEvent, CoreShowDetail detail) {
    System.out.println("HelloServer Exiting ...");
    if (disclosureEvent.isExpanded()) {
    System.out.println("HelloServer Exiting1 ...");
    // detail.setDisclosed(!detail.isDisclosed());
    System.out.println("HelloServer Exiting2 ...");
    Thanks,
    Ruchir

  • Binding a JavaFX variable to a Java class instance variable

    Hi,
    I am pretty new to JavaFX but have been developing in Java for many years. I am trying to develop a JavaFX webservice client. What I am doing is creating a basic scene that displays the data values that I am polling with a Java class that extends Thread. The Java class is reading temperature and voltage from a remote server and storing the response in an instance variable. I would like to bind a JavaFx variable to the Java class instance variable so that I can display the values whenever they change.
    var conn: WebserviceConnection; // Java class that extends Thread
    var response: WebserviceResponse;
    try {
    conn = new WebserviceConnection("some_url");
    conn.start();
    Thread.sleep(10000);
    } catch (e:Exception) {
    e.printStackTrace();
    def bindTemp = bind conn.getResponse().getTemperature();
    def bindVolt = bind conn.getResponse().getVoltage();
    The WebserviceConnection class is opening a socket connection and reading some data in a separate thread. A regular socket connection is used because the server is not using HTTP.
    When I run the application, the bindTemp and bindVolt are not updated whenever new data values are received.
    Am I missing something with how bind works? Can I do what I want to do with 'bind'. I basically want to run a separate thread to retrieve data and want my UI to be updated when the data changes.
    Is there a better way to do this than the way I am trying to do it?
    Thanks for any help in advance.
    -Richard

    Hi,
    If you don't want to constantly poll for value change, you can use the observer design pattern, but you need to modify the classes that serve the values to javafx.
    Heres a simple example:
    The Thread which updates a value in every second:
    // TimeServer.java
    public class TimeServer extends Thread {
        private boolean interrupted = false;
        public ValueObject valueObject = new ValueObject();
        @Override
        public void run() {
            while (!interrupted) {
                try {
                    valueObject.setValue(Long.toString(System.currentTimeMillis()));
                    sleep(1000);
                } catch (InterruptedException ex) {
                    interrupted = true;
    }The ValueObject class which contains the values we want to bind in javafx:
    // ValueObject.java
    import java.util.Observable;
    public class ValueObject extends Observable {
        private String value;
        public String getValue() {
            return this.value;
        public void setValue(String value) {
            this.value = value;
            fireNotify();
        private void fireNotify() {
            setChanged();
            notifyObservers();
    }We also need an adapter class in JFX so we can use bind:
    // ValueObjectAdapter.fx
    import java.util.Observer;
    import java.util.Observable;
    public class ValueObjectAdapter extends Observer {
        public-read var value : String;
        public var valueObject : ValueObject
            on replace { valueObject.addObserver(this)}
        override function update(observable: Observable, arg: Object) {
             // We need to run every code in the JFX EDT
             // do not change if the update method can be called outside the Event Dispatch Thread!
             FX.deferAction(
                 function(): Void {
                    value = valueObject.getValue();
    }And finally the main JFX code which displays the canging value:
    // Main.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    import threadbindfx.TimeServer;
    var timeServer : TimeServer;
    var valueObjectAdapter : ValueObjectAdapter = new ValueObjectAdapter();
    timeServer = new TimeServer();
    valueObjectAdapter.valueObject = timeServer.valueObject;
    timeServer.start();
    Stage {
        title: "Time Application"
        width: 250
        height: 80
        scene: Scene {
            content: Text {
                font : Font {
                    size : 24
                x : 10, y : 30
                content: bind valueObjectAdapter.value;
    }This approach uses less cpu time than constant polling, and changes aren't dependent on the polling interval.
    However this cannot be applied to code which you cannot change obviously.
    I hope this helps.

  • (261680070) Q SYNCH-11 How do my web service methods accees EJBs and java classes?

    A<SYNCH-11> How do my web service methods accees EJBs and java classes?
    A<SYNCH-11> It is simple to use java classes, just do it as you would ordinarily.
    The .jws file really contains a simple class so you can program with it in the same
    way that you would use a regular Java class.
    To use an EJB you can go and access it directly as you would with any EJB remote
    client (lookup home stub, create, etc) or if the EJB is deployed to WLS you can use
    a control to provide a very simple wrapper to the EJB. We will see this in detail
    on Thursday in the ADVC module.

    Futher information about the possibility of callback:
    It may be possible for a synchronous only web service (i.e. MS .net) to even paticipant
    in the callback functionality of asynchronous web services. If the client implements
    the appropriate methods for the callback but listens for them on a different port
    or binding than the SOAP request, then web service may be able to build a response
    if the client's "callback URL" is submitted as the beginning part of a conversation.
    Watch the BEA developer forum (http://dev2dev.bea.com) for more information about
    this approach and other tips and techniques for building web services.
    "Adam FitzGerald" <[email protected]> wrote:
    >
    Q<SYNCH-03> I heard that MS .net only implements synchrnonus method? If
    this is true.
    Does it means my async methods will only work with J2EE clients?
    A<SYNCH-03> I do not know the limitations of .net but let me point out that
    is very
    difficult to provide asynchronous web service method invocation (this is
    different
    from an asynchronous web service). HTTP as a general communication protocol
    is based
    on a request and response paradigm so your client libraries will mostly
    likely be
    expecting a response even if it is empty (check the asynchronous example
    from today
    to see that the start method still returns an empty response). You must
    distinguish
    this from the notion of an asynchronous web service which is a business
    operation
    that occurs on the server whose return value/result is not directly associated
    with
    building response to the client. An asynchronous web service can (and generally
    will)
    be started and stopped with web service operations that are invoked synchronously.
    Thus MS .net clients can still be client to WLS hosted web services.

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

  • OAAM 11g R2: Unable to load java class for custom configurable action

    Need to configure a Configurable Action to get triggered for a particular action at a given checkpoint.
    Steps Followed:
    1. Created a java class implementing com.bharosa.vcrypt.tracker.dynamicactions.intf.DynamicAction, getParameters() and execute() methods were implemented in that java class.
    2. Added necessary jars from $ORACLE_IDM_HOME\oaam\cli\lib to the build classpath.
    3. Compiled and created a jar with it.
    4. Extracted the oracle.oaam.extensions.war file into a working folder.
    5. Added the Custom Jar created in step 3 into <working folder>/WEB-INF/lib/
    6. Changed the following in MANIFEST.MF in <working folder>/META-INF/:
    Specification-Version:11.1.2.0.1
    Implementation-Version:11.1.2.0.1
    7. Rejar-ed the oracle.oaam.extensions.war from the working folder using following command:
    jar -cvfm oracle.oaam.extensions.war <working folder>\META-INF\MANIFEST.MF -C <working folder>/ .
    8. Stopped the oaam_admin_server1, oaam_offline_server1 and oaam_server_server1.
    9. Deleted the oracle.oaam.extensions deployment from the weblogic.
    10. Deployed the newly created oracle.oaam.extensions as a shared library for oaam_admin_server1 and oaam_server_server1.
    11. Started all managed servers.
    But when I tried to create an action template with the java class I just created, it was throwing following error
    +java.lang.ClassNotFoundException: *+
    Unable to load configurable action class *. Ensure the class is made available in the class path.
    Referred following documents:
    1.      http://docs.oracle.com/cd/E27559_01/admin.1112/e27207/cfgactions.htm
    2.     http://docs.oracle.com/cd/E27559_01/dev.1112/e27206/cfg-action.htm
    3.     http://docs.oracle.com/cd/E27559_01/dev.1112/e27206/extend.htm
    Kindly help me. Thanks in advance.
    Edited by: 917717 on Dec 12, 2012 7:16 PM

    This thread is a bit stale but I thought it might help to clarify one point about custom jar files on UCCX.
    To properly load a custom jar:
    Upload it into the classpath directory in the document repository. 
    Select it under System | Custom Classes Configuration
    Finally you need to restart the CCX Engine and the CCX Administration services.  If you have HA you need to restart them on both servers. 
    Other notes:
    When referencing your class in the CCX Editor, use the fully qualified name of the class.  Lots of other classes use things like Element or Document so you need to be explicit. The editor only knows about the 20 native classes by their object names.  If you create a Document object in the editor you are really creating a com.cisco.doc.Document object.  If you loaded jdom.jar and you wanted a jdom document then you need to create an object of type org.jdom.Document.
    When compiling your custom jar files, be sure to compile for the version of Java that the CCX Engine runs.  In general UCCX 7.X and older use Java 1.4.  UCCX 8.X and higher use Java 1.6.  Several of the core Java classes had significant changes between 1.4 and 1.6. If you ran your code on UCCX 7 or earlier and now it fails in UCCX 8.X or higher, recomplile for Java 1.6 and you classes will likely work again.
    Finally, check for security violations in UCCX 8.X or higher.  Cisco has restricted some of the things you can do.  These URL's have more information:
    http://docwiki.cisco.com/wiki/Engine
    http://docwiki.cisco.com/wiki/Troubleshooting_Tips_for_Unified_CCX_8.0
    -Steven
    Please help us make the communities better.  Rate helpful posts!

  • Java classes and MySql Files

    Hello,
    There is a way to distribute the Mysql db files with yout java application without need to install Mysql in the computer, like in access, you just copy the .mdb file with your java class and create a conection to it.
    Thank You

    No. If you want to do that you should just use Access. mySQL files will not work without the mySQL server.

  • How to refer java class in c++

    Dear All,
    We have the requirement to access one java class from c++ program. Please share your ideas which will take me towards the right direction.
    Thanks in advance

    Naturally you can't do much with a java class without bringing in the whole machinery of the JVM and it's libraries. The mechanisms to run Java from another language (and vica versa) are in the JNI (Java Native Interface). This would allow a C++ program to load the JVM and a named java class and execute methods on it as well as doing the necessary type conversions.

  • Communication between 2 servlets/java classes.

    Hi,
    I’ve a problem. Not sure if it’s a simple one.
    I have a web app with servlets (say Servlet1, Servlet2, etc.) in it. I use a SQL query in Servlet1 and fetch an employee’s information (say empinfo) from the database. This is a string value. Now, I need to pass this “empinfo” to Servlet2.
    I might sound dumb till here but please continue till the end to know what I still have to say…
    1.     I tried using getters and setters. Servlet2 has the “empinfo” value I need. This is the first time Servlet2 is accessed.
    2.     But, think that Servlet1 is transferring the control to an html page. And, this html page submits its parameters (say manager) to Servlet2. And, when this html passes its control to Servlet2, the “empinfo” value I need is gone because I used “empinfo” as a class member/global.
    3.     So, when the control enters the Servlet2 the second time everything is lost and this is when I need the “empinfo” value.
    4.     I cannot make the “empinfo” value in Servlet2 “static” because it keeps changing.
    Note: I tried with all these: httpsession, reflection, etc. but nothing seems to fulfill my task.
    Actually, Servlet2 lets the users to download the “empinfo” when a link on the html page (which sends the parameters to this servlet) is clicked.
    I used httpsession to store this “empinfo” in Servlet1 and used to grab the value in Servlet2.
    Then, I ran this app on my localhost. Then:
    Step1: I opened up one browser and when I clicked the link on html, I checked the “empinfo” value. It was fine.
    Step2: I opened up another browser and when clicked the link on html, I checked the “empinfo” value. It worked again.
    Step3: Now, I went back to the html page in the browser1 and clicked the link and checked to see the “empinfo” value and now it has the value of that in browser2.
    The “empinfo” always had the latest value. Previous values are overwritten.
    If I could find a way to cache the Servlet1 object to use it in Servlet2 then I think my job is half done because even if I let Servlet2 keep a reference of the Servlet1, the html page is ruining the desired result.
    If anyone can let me know how to do this with normal Java classes even that works for me.
    Thanks in advance.

    Thanks for the reply.
    Actually, when I used the session the IE browser behaved properly and its the FireFox that was weird.
    I think this is because Firefox uses single cookie for many instances of itself.
    Thanks again.

  • Example of binding an object(just a java class not an EJB) to a JNDI name

    Hi,
    I would appreciate your help if you could give me some pointers regarding where
    to find any examples which uses objects ( a java class not an EJB) to a JNDI name.
    I could get an example to work using String but it doesnt work with a java class
    object.
    Thanks a lot,
    Sunitha

    Try making the java object serializable.
    - Naresh
    "sunitha" <[email protected]> wrote:
    >
    Hi,
    I would appreciate your help if you could give me some pointers regarding
    where
    to find any examples which uses objects ( a java class not an EJB) to
    a JNDI name.
    I could get an example to work using String but it doesnt work with a
    java class
    object.
    Thanks a lot,
    Sunitha

  • Java.io.NotSerializableException when trying to invoke java class Business Operations in studio

    According to WLI docs, the Java Class Business Operations doesn't need to be Serializeable.
    But somehow everytime I try to invoke the Busines Operations in studio, It always
    throws me exception : java.io.NotSerializableException. Is it something wrong
    with my Java Class ? The operation seems to be executed successfully but after
    that It looks like WLI is trying to serialize the object into database which can
    not be done because the Java Class is not serializeable. Changing the Java Class
    to serializeable is not an option since I don't have any control on this class.
    Please advise...
    regards,
    Martin

    According to WLI docs, the Java Class Business Operations doesn't need to be Serializeable.
    But somehow everytime I try to invoke the Busines Operations in studio, It always
    throws me exception : java.io.NotSerializableException. Is it something wrong
    with my Java Class ? The operation seems to be executed successfully but after
    that It looks like WLI is trying to serialize the object into database which can
    not be done because the Java Class is not serializeable. Changing the Java Class
    to serializeable is not an option since I don't have any control on this class.
    Please advise...
    regards,
    Martin

  • Exceptions thrown when Java Class is imported.

    hi
    This problem comes when I imported a java class in forms 6i. To dig out problem, I made a simple "Hello World" class, import it to forms, use it. It works fine in client/server and on web as well. BUT when i close the form on web (only)by exiting from browser, it throws as exception. message appeared on screen is as
    "ifweb60.ese -- Application error
    "The exception unknown software exception occurred in the application at location ..."
    I m using forms 6i with patch 4a, this problem is occurring with every java class. I even used ORA_JAVA.delete_global_ref( object), after using java class. but i doubt that object could n't deleted with it. cuz after using delete method, i checked the object with ORA_JAVA.IS_NULL and it is not found null :)
    Any one, who has come across this problem and got soln, please help me
    Thanks
    Asif
    null

    Bola,
    This is a benign warning message, but indeed a bug. It is currently being tracked
    as CR059395 internally. It did not make it into the upcoming 3.5 sp2. If this
    problem is causing you trouble, you may wish to request a patch through your Support
    channel.
    Cheers,
    PJL
    "Bola Taylor" <[email protected]> wrote:
    >
    >
    >
    Hi all
    I am currently getting some exceptins thrown each time I view any news
    items without
    logging into personalisation server.
    It is a warning but exceptions are being thrown
    Here are the errors in the attached file
    Any help would be appreciated
    Bola

Maybe you are looking for

  • How do I use a Mac keyboard for Windows functions?

    I just changed from an HP to a MacBook Pro and I'm running Windows XP on part of the hard drive. The problem is that I'm missing my key buttons, like <fn><prt sc> to print the screen or <insert> and <delete>. I can't figure out how to compensate for

  • Reliability and Speed of Yahoo Push Email

    Is anyone else finding Yahoo "push" email to be unreliable? I find when it works, it works well, and I get emails that I send from a home email server in less than 1 minute. However sometimes it seems to fail completely or take a very long time. By f

  • My iopd info went on to my friends

    So my friend plugged in her newly aquired ipod 4g and I synced it but what I really did was restore it to my ipod and now all my info is on hers how do I change it back.

  • BOXI3 - Java SDK : Setting developpement environment

    Hello, I want to create a java application using the Business Objects SDK for Java. I need some help to install and configure my developpement environment on Windows Xp. I read there is a document named c2018319 on http://technicalsupport.businessobj

  • Does Retry events handle the multi-value field correctly.

    Hi , Just curious if the retry event task handle the multi-value event correctly. Let say we have five values a1, a2, a3, a4, a5 in a child table and while provisioning a2 and a4 get failed. Now when the retry task will run how will it be sure that i