Create Java bean for a http session

how can i create a java bean for an http session. also is it possible to access it from another java class within that session

Try the following forum (about JSP technology)
http://forum.java.sun.com/forum.jspa?forumID=45

Similar Messages

  • Java beans for calendar utility

    Hii Javaities
    I need to have calendar in my jsp for choosing dates
    Earlier i was uisng javascript for calendar but now i want to use Java beans .
    Can i use Java beans for calendar ?
    Are there any tag libraries for tht ?

    PDAs ? hmm...sounds interesting
    what technology have u thought of using for your application ?
    java microedition ...[certainly not c++ or .net] ?
    Is it going to be a stand alone application on a PDA .
    OR
    Are you thinking of wireless internet connectivity to the PDA? In this case your application might have to be designed strickly so that it fits the screen size.
    How about a tablet PC? It good for mobile computing and is handy too.
    See this link for tablet PC
    http://www.motioncomputing.com/

  • Java Bean for Marquee or scrolling text

    Can anybody help to make the simple java bean for scrolling a text in ORacle forms 10g?
    Regards
    Omama Khurshid

    Please help me and send it to my mail.
    [email protected]

  • Help required in building up the Java Bean for an XML data

    Hi ,
    I want to build a Java bean which will actually represent an xml data . The class will be named as User and it will typically represent the data in the follwing xml:
    <user>
    <cwsId>barbete</cwsId>
    <firstName>William</firstName>
    <lastName>Barber</lastName>
    <status>true</status>
    <role>
    <roleCode>1000000177</roleCode>
    <roleName>Customer Administrator</roleName>
    </role>
    <language>en</language>
    <country>US</country>
    <preferences>
    <equipmentGroup>2717</equipmentGroup>
    <dateFormat>MON-dd-yyyy</dateFormat>
    <timeFormat>HH:MI AM</timeFormat>
    <timeZone>-12:00</timeZone>
    <daylightSavings>Y</daylightSavings>
    <location>NC</location>
    <recordsPerPage>10</recordsPerPage>
    <historyPeriod>3</historyPeriod>
    <distanceUnit>MILE</distanceUnit>
    <fuelUnit>G</fuelUnit>
    <unitIdDisplay>E</unitIdDisplay>
    <smuUpdate>W</smuUpdate>
    <countries>
    <country>
    <countryCode>GB</countryCode>
    <countryName>UNITED KINGDOM</countryName>
    </country>
    <country>
    <countryCode>US</countryCode>
    <countryName>UNITED STATES</countryName>
    </country></countries>
    </preferences>
    </user>
    Now for single child nodes like cwsId of the main user node i have kept properties like
    private String cwsId;
    But i am not sure as to how to represent the nodes which contain subnodes like "preferences"node. Any ideas?What is the standard practice?

    One thing you could do is create an object model first, which will contain all the data for your user.
    then all you need in the bean is a Hashtable with the name of the user as a key, and the user-object (which is actually the complete object model) as a value.
    with the XML stated by you, you would get an object model something like this:
    Class User
        String cwsid;
        String firstName;
        ArrayList<Role> roles = new ArrayList<Role>(); //I'm assuming a user can have more then one role.
        ArrayList<Country> countries = new ArrayList<Country>();
    class Role {
        String code;
        String name;
    class Country {
        String code;
        String name;
    }And so on for all the varioous elemets of your XML.

  • Java bean for database access

    Hi,
    I am writing a JSP/servlet/Javabean based app. using MVC architecture.The database related logic is in java beans.
    I want a generalized class/bean that can form a connection , execute the passed query and return the results.Does any one has any URLs or sample code to explain how to do this using introspection?
    I would greatly appreciate any help as this design is very crucial for our application.
    Thanks -
    k

    i don't think it need help,every book has such code,maybe i haven't understanding your meaning correctly,follow steps:
    1 create a class named DBconnect,
    2 in the constructor of the class,you create the connection,
    3 add several methods that execute the operation into your class ,such as :executeQuery(),executeUpdare().....
    that depands the requirement of your project.

  • Creating java bean

    Hi all,
    I am stuck with my first java bean, can anyone please help!? I've serahed the net and this forum, but the closest one to my problem that I can find is this one, http://forum.java.sun.com/thread.jspa?threadID=571292&messageID=2850205. However, it does not help me much. The following are the steps that I took.
    Thanks,
    Welles
    1. Create a class
    package testBeans;
    public class TestClass
         public static void main(String[] args)
              System.out.println("Hello World!");
         public void runTest(){
    2. Complie the java file to the testBeans folder under the current folder
    c:\work>javac -d . TestClass.java
    3. Create the jar file
    c:\work>jar cvf testBeans.jar testBeans/*.*
    added manifest
    adding: testBeans/TestClass.class(in = 483) (out= 315)(deflated 34%)
    4. Put the testBeans.jar in C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext
    5. Create a driver class
    import testBeans.*;
    public class BeanDriver
         public static void main(String[] args)
              TestClass.runTest();
    6. Complie the BeanDriver.java file, but I get the following error message :(
    ---------- javac ----------
    C:\test\BeanDriver.java:7: cannot access TestClass
    bad class file: .\TestClass.java
    file does not contain class TestClass
    Please remove or make sure it appears in the correct subdirectory of the classpath.
              TestClass.runTest();
    ^
    1 error
    Output completed (0 sec consumed) - Normal Termination

    Crossposted, so don't anyone waste their time answering it here. Answer over here instead:
    http://forum.java.sun.com/thread.jspa?threadID=624016
    @OP: Crossposting is rude.

  • Pass array of value to Oracle Java Beans (for forms)

    Hi,
    How I can pass a array value from oracle Form to Java bean.
    With regards
    Satheesh Kumar

    Hi,
    Thanks for your immediate response.
    I have one more doubt. I am trying to create a Hirachical tree for form using Jtree. For dynmically populating tree data I want to pass array records from oracle forms.
    In my understanding, Java importer array will work if we do importing the java beans component to oracle forms, otherwise no.
    Is it possible I can pass array variable with out importing my javacomponent.
    With regards

  • How to create a service for Oracle HTTP Server

    Hi,
    I hope someone can help me.
    I would like to create a service for an Oracle HTTP Server.
    We are running APEX 3.2 on an 10.2.0.4 database (not XE).
    We have a Windows XP system.
    To run APEX on a 10g we need the HTTP Server.
    Unfortunately no service was created while the installing of the Oracle HTTP Server.
    How can I create a service later. After the installation.
    I know that you can create a service with Instrsrv.exe and Srvany.exe. But I dont know wheather I can use this in this case.
    I need an .exe file for that.
    The HTTP-Server has the opmnctl.exe.
    But I have to write opmnctl.exe startall when I start or opmnctl.exe stopall when I want to stop it . How can I realize that in a Service?
    Thanks for your answer
    Jens

    Hi,
    I hope someone can help me.
    I would like to create a service for an Oracle HTTP Server.
    We are running APEX 3.2 on an 10.2.0.4 database (not XE).
    We have a Windows XP system.
    To run APEX on a 10g we need the HTTP Server.
    Unfortunately no service was created while the installing of the Oracle HTTP Server.
    How can I create a service later. After the installation.
    I know that you can create a service with Instrsrv.exe and Srvany.exe. But I dont know wheather I can use this in this case.
    I need an .exe file for that.
    The HTTP-Server has the opmnctl.exe.
    But I have to write opmnctl.exe startall when I start or opmnctl.exe stopall when I want to stop it . How can I realize that in a Service?
    Thanks for your answer
    Jens

  • I tried Oracle Java Bean for getting client IP but keep getting 127.0.0.1

    We implemented Oracle Java Bean demo that reads client
    information as we need to know the IP address of the client.
    Everything works fine except that we keep getting the loopback
    address (127.0.0.1) instead of the client IP address.
    Any advice?

    I figured out what was happening and thought I should post the resolution in case it helps someone else.
    I have both the original ToyStore app and my new app running against the same schema. Fine so far, since they don't use the same table names and this is just for early development.
    The problem comes because they also use the same schema for maintaining the "Stateful" release mode. So they were both accessing the PS_TXN table to maintain state. For some reason, this worked for a while, but started failing yesterday. Clearing out the PS_TXN table when switching apps solved the problem.
    Clearly the admonition to use a separate schema for the internal connection used by the state management logic is a wise one! :-)
    Dennis

  • Need help in countdowntimer in java bean for jsp page

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

  • Creating Java code for the function module

    Hi Colleagues,
    I have a fuction module in ABAP system. Now I want to Generate java code for the FM.
    I cam to know that we can achive that using AXIS, By getting the XML file for the fuction module and generate Java
    Class file using that XML file.
    Can any one tell me how to achive it.
    Or any other way to do that?
    Please provide you valid suggestions.
    Regards,
    Sathya

    Hi,
    You can integrate axis2 in eclipse. I think you have to find the plugin for that.
    After that you can let axis generate the jave code (stubs and proxies) for your web service via the wsdl file.
    Kind Regards,
    Robin

  • SAME EJB 3.0 Stateful Session bean for different JSP sessions returned

    Forum,
    I have a strange problem utilizing stateful session beans. Please note, that I am using jdeveloper for the following:
    1) Here is a basic stateful session bean:
    @Stateful(name = "DemoClass")
    public class DemoClassBean implements DemoClass,
               DemoClassLocal, SessionSynchronization {
          public static int id=0;
          public DemoClassBean() {
          id++;
          public int getId() {
             return id;
          //... other methods
    }2) This bean is accessed from a JSP for testing purpose, I am copying only the script used in JSP:
    <%
       DemoClass bean = null;
       try {
          bean = (DemoClass) ((new javax.naming.InitialContext()).
                       lookup("DemoClass "));
          System.out.println("ID=" + bean.getId() );
          } catch (javax.naming.NamingException e) {
             // TODO
    %>If this page is addressed by different clients, from different browsers, the same bean is returned.
    Here is what I see in the logs:
    ID=1
    ID=1
    ID=1
    The same problem is being observed when this session bean is accessed from a JSF Backing bean.
    What could be wrong? Is this a bug in oc4j / jdeveloper (version 10.1.3.3.0)?
    Edited by: smw000000001 on Nov 17, 2008 10:52 AM

    Hi,
    The code for stateful is perfectly fine and working in a normal way. The way you are trying to implement the stateful session bean in your application is wrong.
    think of binding the stateful session bean with HttpSession object.
    So that you will get a unique stateful session bean object.

  • Java sniffer for a TELNET session

    Hi
    I need to interpret test results of a telnet session using a java sniffer..........how do I do this.
    Thx
    Frederd

    I need to interpret test results of a telnet session
    using a java sniffer..........how do I do this.You'll need to use two computers to do this, since Telnet uses a "well known port" to accept connections (look at www.iana.org for port number). Since only one process can hold a port, you'll need to run your telnetd on one machine, and have clients connect to another where your sniffer owns that port.
    Once you've set this up, the sniffer itself is a simple pass-through portal: it accepts a request, makes a corresponding connection to the actual telnetd, then simply passes bytes from one connection to the other (logging them in the middle).

  • Create a web service from java bean and map exceptions to SOAP faults

    Hi,
    We have to expose our Session stateless EJB3 as web services. I've tried to use annotations and jdev wizard "java bean to web service" and it works fine.
    Our problem now is that our methods can throw a business exception that contains a list of error message strings to be presented on the client.
    I did not find any way to use annotations to make it build a wsdl with soap fault mapped to our exception class. Neither I could to make the wizard to create wsdl with faults.
    As we are exposing already designed and implemented classes as web services, I think the bottom-top (java->wsdl) approach is better that top->botton (wsdl->java). Therefore, I'm looking for a possibility to generate the web services from the java beans and have the exception be mapped to a soap fault message.
    We are using jdev 10.1.3.1 and OAS 10.1.3.1., is there a way to map exceptions to soap faults using bottom->top approach?
    thank you

    A couple of links that may be of help:
    http://www.netbeans.org/servlets/ReadMsg?listName=nbj2ee&msgNo=1218
    My last question concerning web services:
    I have already written a session bean and I'd like to add some methods
    as a web service to it, how do I do that?
    Or I can only create another bean for a webservice and cannot modify the
    original one?You might create web service with existing sources and select you bean. New web services with appropriate lookup method will be generated.
    All web service method, that will be exposed in web service, you
    should add itself (Pop-up menu Web Service -> Add operation)
    http://usersguide.netbeans.org/files/documents/40/73/Chapter9-WebServices.pdf

  • Failover for a stateful session EJB on a two node cluster results in java.io.StreamCorrupedException

              Stateful session EJB is deployed on cluster members A and B. Client calls a method
              on the bean and the request is routed to server A, then A is shut down. The client's
              next method invocation is routed to server B where the bean's state has been replicated.
              Server A re-joins the cluster and B is shut down, the request routed to A results
              in the following:
              java.rmi.NoSuchObjectException: Activation failed with: java.io.StreamCorruptedException:
              InputStream does not contain a serialized object
              at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
              at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
              at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:33)
              at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:43)
              at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:54)
              at weblogic.ejb20.swap.PassivationUtils.read(PassivationUtils.java:50)
              at weblogic.ejb20.swap.ReplicatedMemorySwap.read(ReplicatedMemorySwap.java:111)
              at weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSessionManager.java:178)
              at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:236)
              at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
              at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
              at com.access360.enrole.apps.ejb.organization.SearchManagerBeanEOImpl.findAllPeople(SearchManagerBeanEOImpl.java:644)
              at com.access360.enrole.webclient.organization.person.PeopleList.getPeople(PeopleList.java:148)
              at com.access360.enrole.webclient.organization.person.PeopleListServlet.constructPeopleListXML(PeopleListServlet.java:284)
              at com.access360.enrole.webclient.organization.person.PeopleListServlet.service(PeopleListServlet.java:238)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:183)
              at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.forwardToPeopleList(SubmitPersonAddServlet.java:134)
              at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.service(SubmitPersonAddServlet.java:114)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              We are certain that the EJB's entire object graph is Serializable. Any comments on
              this failover scenario?
              Alex Rodriguez
              Software Engineer, Access360
              [email protected]
              

              Rajesh,
              Thanks for the reply. We are running WL 6.0 SP2 with RP3. We cannot reproduce it
              consistently. In your reply you mention "... and EJB handles". Does that refer to
              another patch?
              As for the code, we will run tests with a scaled down version of the stateful bean
              and a simple client servlet. I will post the code asap. The high level call sequence
              is: servlet service() -> lookup ejb home -> get cluster aware stub from home -> put
              bean handle in http session -> call bean method -> server A goes down -> next call
              to the bean -> get handle from replicated http session -> get bean from handle ->
              request is routed to server B. java.io.StreamCorruptedException is thrown, sometimes,
              when server A re-joins the cluster and a request is routed to it (i.e. server B is
              shut-down). One thing I did not mention is that the bean is deployed on server A,
              and server A is also the Admin server. We are considering not using the Admin server
              to deploy the bean, however, but will add another Managed server.
              Will contact support about CR073917: can it be applied to WL 6.0 SP3 with RP3?
              Regards,
              Alex J. Rodriguez
              Rajesh Mirchandani <[email protected]> wrote:
              >
              >Alex,
              >
              >Are you able to consitently reproduce this? Could you post your code here?
              >
              >What version of the Server with Service pack are you using?
              >
              >If you are using WLS 6.1SP2 and EJB handles contact support and get a patch
              >for CR073917.
              >
              >
              >"Alex J. Rodriguez" wrote:
              >
              >> Stateful session EJB is deployed on cluster members A and B. Client calls
              >a method
              >> on the bean and the request is routed to server A, then A is shut down.
              >The client's
              >> next method invocation is routed to server B where the bean's state has
              >been replicated.
              >> Server A re-joins the cluster and B is shut down, the request routed to
              >A results
              >> in the following:
              >>
              >> java.rmi.NoSuchObjectException: Activation failed with: java.io.StreamCorruptedException:
              >> InputStream does not contain a serialized object
              >> at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
              >> at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
              >> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:33)
              >> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:43)
              >> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:54)
              >> at weblogic.ejb20.swap.PassivationUtils.read(PassivationUtils.java:50)
              >> at weblogic.ejb20.swap.ReplicatedMemorySwap.read(ReplicatedMemorySwap.java:111)
              >> at weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSessionManager.java:178)
              >> at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:236)
              >> at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
              >> at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
              >> at com.access360.enrole.apps.ejb.organization.SearchManagerBeanEOImpl.findAllPeople(SearchManagerBeanEOImpl.java:644)
              >> at com.access360.enrole.webclient.organization.person.PeopleList.getPeople(PeopleList.java:148)
              >> at com.access360.enrole.webclient.organization.person.PeopleListServlet.constructPeopleListXML(PeopleListServlet.java:284)
              >> at com.access360.enrole.webclient.organization.person.PeopleListServlet.service(PeopleListServlet.java:238)
              >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              >> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
              >> at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
              >> at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:183)
              >> at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.forwardToPeopleList(SubmitPersonAddServlet.java:134)
              >> at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.service(SubmitPersonAddServlet.java:114)
              >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              >> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
              >> at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
              >> at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
              >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >>
              >> We are certain that the EJB's entire object graph is Serializable. Any
              >comments on
              >> this failover scenario?
              >>
              >> Alex Rodriguez
              >> Software Engineer, Access360
              >> [email protected]
              >
              

Maybe you are looking for