Can't get events to flow from Java to VB

I've seen some past topics relating to this but none gives a concrete example of making it work.
I've created a bean with a single method, a fw properties and one event. I've run the packager and regestered everything in VB. The bean has no GUI. I've created a simple VB app with one command button which creates the instance, sets some properties and calls the start method. All of this works great. My Java code runs to completion. When the Java code starts and finishes it sends a notify. The event code never gets popped in VB.
I've created the events and listener interface per the documentation. At run time I have one listener registered which is of the following class:
sunw.demo.encapsulatedEvents.DYN_EE_ADAPTOR.myPackageName.myListenrInterfaceName
This name comes from the toString() for the listener object.
That is my first question. Why is a demo class involved? Where did this come from?
My VB code is as follows:
Dim X As Object
Private Sub Command1_Click()
Set X = CreateObject("MyActiveXName.bean.1")
X.ConfigFile = "home.cfg"
X.LicenseKey = "0524416687182640982341"
X.start
End Sub
Public Sub X_started(ByVal StartedEvent1 As Object)
MsgBox "Got started event"
End Sub
Here is the definition of the event as it shows up in the ObjectBroswer in VB:
Event started(StartedEvent1 As Object)
I also have a stopped event but I didn't want to clutter the example.
Any help would be appreciated.

I got it to work. If you look in the original post I was using a DIM statement to create the object. That doesn't seem to work for events.
I had to drag an instance onto the canvas (even though it is not visual) and have VB assign a variable name. Everything all of a sudden worked.
Now I have another problem. Sending a notification during a method call from VB works great. However, sending a notification from a separate background thread in my Java code causes VB the get a GPF. I put up a msg box upon receipt of the event. As soon as I click OK on the msg box, it blows up. Maybe I just shouldn't put up a msg box.

Similar Messages

  • How can i get the source code from java concurrent program in R12

    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    Zulqarnain

    user570667 wrote:
    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How can I get the "text" field from the actionEvent.getSource() ?

    I have some sample code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class JFrameTester{
         public static void main( String[] args ) {
              JFrame f = new JFrame("JFrame");
              f.setSize( 500, 500 );
              ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
              buttonsArr.add( new JButton( "first" ) );
              buttonsArr.add( new JButton( "second" ) );
              buttonsArr.add( new JButton( "third" ) );
              MyListener myListener = new MyListener();
              ( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
              JPanel panel = new JPanel();
              panel.add( buttonsArr.get( 0 ) );
              panel.add( buttonsArr.get( 1 ) );
              panel.add( buttonsArr.get( 2 ) );
              f.getContentPane().add( BorderLayout.CENTER, panel );
              f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              f.setVisible( true );
         public static class MyListener  implements ActionListener{
              public MyListener() {}
              public void actionPerformed( ActionEvent e ) {
                   System.out.println( "hi!! " + e.getSource() );
                   // I need to know a title of the button (which was clicked)...
    }The output of the code is something like this:
    hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
    border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
    flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
    right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
    rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
    I need this: "first" (from this part: "text=first" of the output above).
    Does anyone know how can I get the "text" field from the e.getSource() ?

    System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
    In a real-world application, no.
    In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
    In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
    All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
    Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button).

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • When creating a book how can I get all the photos from an album to show up in the order they were in the album?

    When creating a book in iphoto, how can I get all the photos from the album I want to use to show up in the order that they are in the album?  When I tried to use the option to add my own photos instead of having the program "flow" them, they showed up all mixed up.

    iPhoto puts them in the book in chronological order.  So to get your photos from an album into an iPhoto book in the same order you will need to use the Photos ➙ Batch Change ➙ Date menu option and set them all to the same date with a 1 minute time difference between each. 
    OT

  • How do I get text to flow from one page to the next in Pages 5?

    How do I get text to flow from one page to the next in Pages 5 with the Maverick system?

    What may be overlooked in Pages v5 is the notion of combining Text Boxes via the Menu > View > Show Arrange Tools. When you select two Text Boxes, an extra panel unfolds at the bottom of the Arrange Tools window. Uncheck one Text Box and this panel abruptly disappears.
    One can achieve text flow effects between Text Boxes differently based on how one positions the Text Box overlap, and choice of effect above. Though not the accustomed flow found in Pages ’09 v4.3, flow does occur. Consider the possibilities of combining a Shape and a Text box to cut an irregular Text box.
    If I create two Text Boxes and position them side by side with outline touching and choose Unite, this creates one larger Text Box and text flows across and down. On the otherhand, if I overlap the upper left corner of a lower Text Box over one above and to the left, then choose Union, pasted text fills the first Text Box and then flows across and down into the other box. Here is a Union example:
    Intersect will leave a small Text Box where the two overlap, so not much value there. Subtract will cut a chunk out of one Text Box that is the size of the overlapping piece of the second Text Box:
    And Intersect will leave an island in the center where the two Text Box overlap, with flow jumping over this bridge.
    Clearly, this is not what we were accustomed to in the past, but with imagination, style, and layout tuning, it does offer alternative Text Box creativity and layout. Of course, there is the option of simply returning to the previous Pages version for true Text Box linking that most will want to use.

  • No Mail. I can not get or send mail from my iPhone,iCloud, or mail  on the desktop. Password is correct i can get into iCloud but not able to get mail.

    I can not get or send mail from my iPhone, iCloud, and desktop mail.  All are the same account, password is right and working. When the problem first happened I updated to a new  password.
    The Mail and the phone are telling me ( "The iCloud IMAP server “p99-imap.mail.me.com” rejected the password for user “k****n******2”}
    From the iCloud account i get a message saying  mail could not be loaded and the details. Which i have copyed below.
    Any thoughts or anyone I can ring ? This was a paid for mobile me account.
    Thanks
    Running 10.72
    ORIGIN
    server
    TYPE
    error
    BUILDNUMBER
    1FCS29.34215
    TIME
    Sun Dec 11 2011 10:49:50 GMT+0000 (GMT)        (1323600590380)
    HOST
    www.icloud.com
    USERAGENT
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7
    PRSID
    217870346
    RECENTLOGMESSAGES
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: MAIL in main()
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: -->  Request 1:   POST to https://p99-mailws.icloud.com:443/wm/preference,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: Request out: /wm/preference-list-->1323600562085/1
              params: {"locale":"en-us","timeZone":"Europe/Dublin"}
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Object:sc1074:dispatch('load content')
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: "2.0 Waiting for Content" handled event 'load content' (no transition)
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Module: Attempting to load 'addresses'
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Module: Module 'addresses' is not loaded, loading now.
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Module: Loading JavaScript file in 'addresses' -> '/applications/mail/frameworks/addresses/en-us/1FCS29/javascript.js'
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Object:sc3099:initStatechart()
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: -> entering "9 Address List Not Visible"
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: -->  Request 2:   GET to https://p03-contactsws.icloud.com:443/co/addressbook/?order=first,last&locale=en _US,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Module: Module 'addresses' finished loading.
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Module: Evaluating and invoking callbacks for 'addresses'.
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: SC.Module: Module 'addresses' has completed loading, invoking callbacks.
    Sun, 11 Dec 2011 10:49:22 GMT:  DEBUG: APPLICATION: Received applicationWillBecomeActive
    Sun, 11 Dec 2011 10:49:23 GMT:  WARN:  APPLICATION: Received applicationDidBecomeActive
    Sun, 11 Dec 2011 10:49:23 GMT:  DEBUG: <--  Response 2:  200  (1257ms),  headers: Cache-Control=no-cache, no-store, private, Content-Type=application/json; charset=UTF-8  body: (omitted)
    Sun, 11 Dec 2011 10:49:25 GMT:  DEBUG: willReceive: Status:500, Request:/wm/preference
    Sun, 11 Dec 2011 10:49:25 GMT:  DEBUG: Got HTTP 500 : Redirecting request: /wm/preference : Redirect count:1
    Sun, 11 Dec 2011 10:49:25 GMT:  DEBUG: -->  Request 3:   POST to https://p99-mailws.icloud.com:443/wm/preference,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:25 GMT:  DEBUG: Request out: /wm/preference-list-->1323600562085/1
              params: {"locale":"en-us","timeZone":"Europe/Dublin"}
    Sun, 11 Dec 2011 10:49:29 GMT:  DEBUG: willReceive: Status:500, Request:/wm/preference
    Sun, 11 Dec 2011 10:49:29 GMT:  DEBUG: Got HTTP 500 : Redirecting request: /wm/preference : Redirect count:2
    Sun, 11 Dec 2011 10:49:29 GMT:  DEBUG: -->  Request 4:   POST to https://p99-mailws.icloud.com:443/wm/preference,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:29 GMT:  DEBUG: Request out: /wm/preference-list-->1323600562085/1
              params: {"locale":"en-us","timeZone":"Europe/Dublin"}
    Sun, 11 Dec 2011 10:49:33 GMT:  DEBUG: willReceive: Status:500, Request:/wm/preference
    Sun, 11 Dec 2011 10:49:33 GMT:  DEBUG: Got HTTP 500 : Redirecting request: /wm/preference : Redirect count:3
    Sun, 11 Dec 2011 10:49:33 GMT:  DEBUG: -->  Request 5:   POST to https://p99-mailws.icloud.com:443/wm/preference,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:33 GMT:  DEBUG: Request out: /wm/preference-list-->1323600562085/1
              params: {"locale":"en-us","timeZone":"Europe/Dublin"}
    Sun, 11 Dec 2011 10:49:37 GMT:  DEBUG: willReceive: Status:500, Request:/wm/preference
    Sun, 11 Dec 2011 10:49:37 GMT:  DEBUG: Got HTTP 500 : Redirecting request: /wm/preference : Redirect count:4
    Sun, 11 Dec 2011 10:49:37 GMT:  DEBUG: -->  Request 6:   POST to https://p99-mailws.icloud.com:443/wm/preference,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:37 GMT:  DEBUG: Request out: /wm/preference-list-->1323600562085/1
              params: {"locale":"en-us","timeZone":"Europe/Dublin"}
    Sun, 11 Dec 2011 10:49:40 GMT:  DEBUG: willReceive: Status:500, Request:/wm/preference
    Sun, 11 Dec 2011 10:49:40 GMT:  DEBUG: Got HTTP 500 : Redirecting request: /wm/preference : Redirect count:5
    Sun, 11 Dec 2011 10:49:40 GMT:  DEBUG: -->  Request 7:   POST to https://p99-mailws.icloud.com:443/wm/preference,  headers: Content-Type=text/plain,  body: (omitted)
    Sun, 11 Dec 2011 10:49:40 GMT:  DEBUG: Request out: /wm/preference-list-->1323600562085/1
              params: {"locale":"en-us","timeZone":"Europe/Dublin"}
    Sun, 11 Dec 2011 10:49:44 GMT:  DEBUG: willReceive: Status:500, Request:/wm/preference
    Sun, 11 Dec 2011 10:49:44 GMT:  DEBUG: <--  Response 7:  500  (4248ms),  headers: Content-Type=text/html  body: (empty)
    Sun, 11 Dec 2011 10:49:44 GMT:  DEBUG: Request in: /wm/preference-list-->1323600562085/1,500,4249ms
    Sun, 11 Dec 2011 10:49:44 GMT:  DEBUG: ServerPreferencesDataSource.retrieveResponse error = -1/500/guid=serverPrefsGuid
    Sun, 11 Dec 2011 10:49:44 GMT:  ERROR: CoreMail handled error 13002 before exiting Mail

    Spent at least 40 min talking to apple support, to sort it out. luckly not at my cost. After trying lots of things and speaking to a higher grade support person I was given a temp password which did the trick. I then was able to reset that with my own password. 
    The impression i got was no one knowns  what the problem is and resetting the password at the apple end works. Not sure if you would be able to self fix.

  • How can I get specific files back from my Time Machine backup?

    I wanted to make a fresh install on my MacBook Pro, in order to only have Java 8 instead of any older Java versions. So far so good. But now I want to get specific files/libraries from my external backup (USB):
    One Parallels Virtual Machine
    My old mail
    My iPhoto Library
    I don't need any settings for these, since I can easily configure them again.
    I already used the Migration Assistent to restore all apps.
    How can I get specific data back from the backup without restoring all stuff that I don't want anymore?
    I'm now working on a new account on the fresh system, called 'Admin'. My old account was called 'Hans' (or 'hans') and I'd like to create such an account again for all my tasks.
    Hans

    How can I get specific data back from the backup without restoring all stuff that I don't want anymore?
    I'm now working on a new account on the fresh system, called 'Admin'. My old account was called 'Hans' (or 'hans') and I'd like to create such an account again for all my tasks.
    You will want to add the same User account(s) which hold the data you want to restore. So you will want to add a User account of 'Hans or hans'. Check your Time Machine back up drive to see how the User account is labeled (Hans or hans). Navigate to the Users folder and see how it's labeled.
    You can then use your Time Machine back up drive and navigate to the User Home folder to copy its data over (e.g. contents from Documents, Downloads, Music, Pictures, etc.). Repeat for other Users.

  • Can I execute MySql's command from java application?

    Can I execute MySql's command from java application? And how?
    For example :
    load data local infile 'D:\\myData.txt'
    into table myTable
    fields terminated by ';'
    lines terminated by '\n';

    1. get the jdbc driver for mysql from the mysql site at: http://dev.mysql.com/downloads/connector/j/5.0.html
    2. follow the installation instructiions... which you'll also find in your mysql manual...
    Happy travels. Keith.

  • Ttrigger Event Sub-Process from Java code.

    Hi All,
    Is there any way to trigger Event Sub-Process from Java code.
    My requirement is to trigger an Event SubProcess when a Approver clicks on REJECT button in HUMAN TASK.
    One way of achieving this is by placing a gateway after the human task and by validating the human task outcome and there by triggering a call to Event SubProcess.
    But we dont want to put a gateway after the human task. But instead we would like to trigger the Event SubProcess from the ADF task forms itself. ie, by calling a JavaCode.
    Please give me some pointers on achieving this task.
    Thanks
    Parker.

    Hi  jtahlborn, mohan
    yes the process is created from my java code. 
    in my code iam creating a process like below and if it is running for a long i need to kill it from java.
    For that " Runtime.getRuntime().exec("taskkill /F /PID " +  7408); " is working fine.
    7408 is my process id in taskmgr created from java and iam manually passing the PID it to kill it.
    But i need to get the PID from java code.
    Thanks for your suggestions.
    Sample Code:
    public static void main(String args[])
            try {
              Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});        
              Field f = process.getClass().getDeclaredField( "handle");
              f.setAccessible( true);         
              long procHandle = f.getLong( process);
              System.out.println( "prochandle: " + procHandle );
              //Runtime.getRuntime().exec("taskkill /F /PID " +  procHandle);
            } catch( Exception e) {
              e.printStackTrace();

  • Get User LockedOut Status from java code

    Hi,
    Our java application is using default security via weblogic 10.3 security realm. If the user enters wrong password more than 5 times in say 5 min interval, then the user is locked out for the next 30 minutes by weblogic. All the parameters are configurable & enabled in security realm from weblogic admin console.
    My question is how can we get user 'isLockedOut' status from my java application so that I can display to the user that the reason you have not been able to login to the application is that the user has been locked out not because your current password is wrong.
    I am looking from something like in here
    http://weblogicserver.blogspot.com/2010/04/user-lockout-wlst.html
    But I don't know how to get the handle to 'ServerSecurityRuntime()' from my java code.
    Please advise.
    Cheers,
    tamu

    Thanks Ravish & Faisal. Both the replies are useful but I had come across this before. I haven't tried them as I have reservation about 2 things for it to be used in production application.
    (1) User credential to logon to admininstration console. It varies from environment to environment & it can change as well. If we have different files to store the passwords for different environments, it will be visible to everyone that have access to the file. It will have security implications.
    (2) The passwords for the environments will keep on changing & if it is incorporated in code, it would require another deployment.
    I am kind of thinking of not using weblogic lockout feature & incorporating within our application & store the values in our app database. This will however require more work. I was hoping I would have been able to catch some sort of exception from weblogic when user account is locked, so that I can display message to the client that the user is locked.

  • How can I get an itunes movie from macbook to apple tv via airplay, how can I get an itunes movie from macbook to apple tv via airplay

    how can I get an itunes movie from macbook to apple tv via airplay?

    You don't use Airplay.  You set up Home Sharing on both and under the Computers section of AppleTV you'll then find it under Movies (or Rentals if rented), assuming it's in a compatible format.
    AC

  • How can i get the max rpm from cpu fan??

    how can i get the max rpm from my cpu cooler regarding that i don't have a speed controller attached to the cpu fan ,,, ??  please make things clear for me
    thanks

    if you have not reduced it by using a speed controller either hardware or software or by the 7v mod its already going as fast as it will at 12 v dc you cannot speed it up only slow it down
    need more air get a different cooler/fan

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

Maybe you are looking for

  • People are receiving my iPhone texts as MMS instead of SMS.

    Many of my friends have non-smartphones which cannot open or receive MMS texts. This is a pain when communication is crucial. Sometimes they will receive my text as SMS, but 48 hours late. Others will receive a text from me, only to find it is what a

  • How to transport an existing infopackage from dev to quality?

    Can anyone pls give me the steps for transporting an existing infopackage from dev to qual? I am not finding any infopackage in RSA - TRANSPORT CONNECTION Points guranteed.

  • [problem] Dbus issue

    Some time ago after update (about 4 months ago) I encountered an issue during some apps interaction. For instance when I want to choose a key file in TrueCrypt and when this window opens sometimes it freezes before showing its content (usually starts

  • Apple push a cessé de fonctionner

    Bonjour, depuis la mise à jour d'Itunes j'ai systématiquement en quittant l'application "apple push a cessé de fonctionner" . Je n'ai pas trouvé d'explications sur la toile... Merci

  • High availability without RAC DB on windows cluster and multiple DB instanc

    Is it possible to achieve High Availability on 2 Oracle DB in windows 2003 cluster servers and shared SAN server. without installing and configuring RAC DB and ASM. Can we use Veritas or Symantec or anyother tool to get it done. What are the options