Using SWING and EJB

Had nebody used Swing for GUI and EJBs for business logic. HEre i need to use Swing for gui rather than JSPs.
Can nebody help??

My question is ...
How do u call EJBs from swing based applets..
In J2EE transaction management cud be done at server side but how will we manage with the swing app??

Similar Messages

  • Need  java code to perform refresh button action using swings and awt

    i need java code to perform refresh button action using swings and awt.please help me

    Wait ! Noboby ? OK, I'll do it
    public void onBtnAction ()
        if (!fresh)
            refresh ();
    }Seriously, did you expect anyone to answer such a cryptic question ?

  • Client remote Authentication using JAAS and EJB Access

    Hi,
    I have a problem using JAAS in combination with Sun One Appserver 8.1 and a java remote client trying to access an EJB. Here is the scenario:
    I have implemented an EJB who's methods are protected through the deployment descriptor:
            <assembly-descriptor>
                 <security-role>
                    <description>role for clients outside of the server </description>
                    <role-name>sedna</role-name>
                  </security-role>
                <method-permission>
                  <role-name>sedna</role-name>
                  <method>
                    <ejb-name>ServerInfoBean</ejb-name>
                    <method-intf>Remote</method-intf>
                    <method-name>*</method-name>
                  </method>
                </method-permission>
                <method-permission>
                  <unchecked/>
                  <method>
                    <ejb-name>ServerInfoBean</ejb-name>
                    <method-name>getVersion</method-name>
                  </method>
                  <method>
                    <ejb-name>ServerInfoBean</ejb-name>
                    <method-name>create</method-name>
                  </method>
                </method-permission>
            </assembly-descriptor>I've deployed the EJB in a jar file which was packed into an ear file of a bigger application. The role has been mapped to the admin Principal in the sun-ejb-jar.xml descriptor.
    I can find the EJB, create it, and call the unchecked method getVersion and that works fine, so far so good.
    But then I try to access another method which is protected and then I get this exception
    org.omg.CORBA.NO_PERMISSION:   vmcid: 0x2000  minor code: 1806 completed: Maybe
            at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:179)
            at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:853)
            at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:137)
    ...I have to mention that I do make a login via the LoginContext. My jaas.config File has a reference to the com.sun.enterprise.security.auth.login.ClientPasswordLoginModule module.
    After login (which works perfectly) I lookup the context with a corbaname url which - if I understood it right - ignores the Context.SECURITY_PRINCIPAL and Context.SECURITY_CREDENTIALS settings.
    After that I make the calls to the EJB. And I am allways ANONYMOUS on the server side, which is definitely the problem. Because ANONYMOUS is not allowed to call the protected EJB Methods. But I made a jaas login in advance. So where am I making a mistake???
    Am I doing something wrong?
    Need help! Thx,
    Stephan

    Hi.
    I understand correctly that you call Subject.doAs on
    the client to call the remote EJB. I guess It isn't
    right way.I had also a bad feeling about this, so I forget it. But anyway it wasn't working with or without using that doAs().
    >
    >
    Subject contextSubject =
    Subject.getSubject(AccessController.getContext());
    contextSubject.getPrincipals();This code throws exceptions in the Appserver. Unfortunately they are catched somewhere so I'm unable to find out what was going wrong. But I guess, that these exceptions where security exceptions. Never the less thanks for the hint!
    But I don't think that doing the check on the server side is the way I want to go because that is programmatically security and I want to use the declarative security which can be used through the deployment descriptor. If used correctly - and supposed I do not completely misunderstand the specification - then it should be possible to create an EJB that is protected via it's deployment descriptor and access it through the client only if the client has been authenticated through JAAS mechanisms. After successful authentication the principal should be accessible through the EJB context but not for security check, that should allready been done at this time.
    Unfortunately I don't find any resource on the internet describing the scenario in such a detail that I can reproduce it. There are only very high level documentations and hints in forums.
    Again, thanks for your effort,
    Stephan

  • Using swing and swt together

    i would like to use some of the components of swt such labels or buttons in swing as swt has better look and feel. but in all the examples i found they are using a whole set of swt api to create frames and showing them up.
    Isnt there any way to add button or label of SWT in Swing. i found a method SWT_AWT.newFrame(). But it is returning a awt frame not a Swing JFrame that at the frame level. i need them at individual component level(buttons and labels).
    hope u understood my problem.. any other suggestions??

    Swing and SWT are two different framework. Usually, peoiple choose one and stick with it. I would not mess with mixing SWT with Swing or vice-versa. I really don't understand why you would choose to mix these two framework together. "better look and feel" is not the best answer for this. what i would look into is a look and feel for Java (like JGoodies look n feel)..and check for Swing component that pther people have made (or enhance upon the Swing library).
    Stick with one framework. Your life will be much easier.
    Futhermore, maintainance would be less difficult. (you only have to know one framework instead of two, plus how they interact)

  • HANDLING CHECKBOXES USING JSP AND EJB

    HI SDN MEMBERS,I AM LEARNING HOW TO CODE IN J2EE.I DISPLAY A FORM WITH CHECKBOXES AND SOME ITEMS BY THE SIDES.NOW THESE ITEMS CAME FROM THE DATABASE BUT ON DISPLAY THE USER SHLD CHECK HIS CHOICE CHECKBOXES THEN SUBMIT.PLS HOW DO I GO ABOUT THIS?

    You need to put the checkboxes and submit button in a <form> tag.
    However, I suggest you read a book on JSP (or read a free comprehensive on-line tutorial) since there is a lot to learn that having a few questions answered in these forums can't begin to cover.
    Also, why are you using EJB? That's an advanced topic and I suggest you use something simpler such as JSP and servlets.

  • Using swing to develop EJB project

    Hi, Folks
    I am using jbuilder7 to develop swing connect to ejb project, one requirement is that i should doing control with the editable table. That requirement make me to tied with JBuilder component JDBTable. However the development time would become remarkable long. does anybody have experience of using fancy swing and EJB in the same project?
    thansk in advance.

    forget to tell you I am using JDBTable already. the problem is that how
    could i serlize the dataset to EJB in a easy way? ok, you don't need to serialize your dataset to trasmit to server side. Class com.borland.dx.dataset.DataSetData implements Serializable interface already, so you can send your dataset to server and do not care about serialization. But what to do with this DataSet on server side is very interesting question ;). As for me, it's not very handly to pull out your data from Dataset on server side (DataSet "looks" like client-side class). But, of course, it's up to you.
    unfortunlly I should doing add, delete, edit from my table. So its
    pretty complex to deal with this sort of issue.Why complex? I don't think so. For example, you may set 2 buttons: "Set" and "Delete" under your Jtable view and just "to fish" data client entered in your Jtable string, pack this data in your own serializable model and send this data to server session facade. As for me that's very handly and fast. And there is no complexity...
    Regards.

  • Desktop like view of files and folders using Swing

    I have an application for upload/download of files from a server. The application is developed using swing and it works perfectly. Currently, the files and folders are displayed in a table view(using jtable) in which the file/ folder will be displayed with icon and extension in each row.
    I need to display these files and folders in a desktop like view. How can I implement this?
    Anees

    Any sample demos or links? Thats why people give you links to the Swing tutorial. The hope is that you will actually look at the Table of Contents and read the tutorial before you post a question.
    Or you could even read the JList API to find a link to the tutorial.

  • Using Swing how can we create socket and send data thru TCP/IP on the socke

    Hi All,
    Can anyone tell the link or answer to me about the Socket programming using Swing and data get & post onto the socket.
    Thanx & Regard
    Ashu

    swing is nothing to do with socket programing, you need to code using core java and API of net
    so please go through this link [http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html]

  • Swing in EJB

    Hi,
    I'm a beginner in EJB and i want to know how do you use swing interface in EJB. What are the changes that are need to be made ? I'm trying to use a swing interface for our famous PetStore Application.
    I appreciate any suggestion about using swing in EJB and the changes that are need to be made.
    Cheers,
    V.Thomas

    You need to make a call to EJB through JNDI from your swing application. Swing is front end application so you can make calls to ejb's.

  • How can i connect multiple forms using swings or applets(AWT) & with D-Base

    Hello Friends,
    I am Sreedhar from Hyderabad. working as a java developer in a small organization. I got a challenge to work on java stand alone (desktop) application. Basically our company is based on SCM(Supply Chain Management), I never work before using swings and AWT. now my present challenge is to develope an application on swings and AWT using Net Beans IDE. but i am unble find the code to connect one form to another form, i want to develop similar application like a web application , suppose if i click on OK button it has to connect next form. in the next for it has to take user name and password should allow me to access main form. please help me about this topic, if anybody interested i can send u the screen shots and i can post to ur mail. please help me as soon as possible,

    sreedharkommuru wrote:
    Hello Friends,
    I am Sreedhar from Hyderabad. working as a java developer in a small organization. I got a challenge to work on java stand alone (desktop) application. Basically our company is based on SCM(Supply Chain Management), I never work before using swings and AWT. now my present challenge is to develope an application on swings and AWT using Net Beans IDE. but i am unble find the code to connect one form to another form, i want to develop similar application like a web application , suppose if i click on OK button it has to connect next form. in the next for it has to take user name and password should allow me to access main form. please help me about this topic, if anybody interested i can send u the screen shots and i can post to ur mail. please help me as soon as possible,There is no magic, you need to spend a good amount of time in tutorials, here is a good one to start off with:
    [The Really Big Index|http://java.sun.com/docs/books/tutorial/reallybigindex.html]
    Here are a few tips:
    1 - Do not mix AWT and SWING: it'll just cause you headaches in the long run that you cannot fix without refactoring to properly not mix the 2 together.
    2 - You use JDBC to access the database
    3 - You make accessors/constructors to pass parameters that you need from one form to another.
    Have fun.

  • Help for a begginer using swing

    Basically I need help with a program for a school project. i am not looking for a quick answer but rather some pointers in the right direction. This is my first time using swing and my first project is to create a blackJack game. I am having trouble with functionality. there are problems on tab 2 with almost all the buttons. any help would be greatly appreciated. since i didnt have enough room for all my code i posted it online to be accessed at this site: [https://code.google.com/p/blackjackgui-alpha/]

    private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
    String betString = jTextField2.getText();
    betString = Integer.toString(bet);// TODO add your handling code here:
    total = total - bet;
      private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        System.exit(0);        // TODO add your handling code here:
      private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        String name = jTextField1.getText();
        String prefix = (String)jComboBox1.getSelectedItem();
        jLabel2.setText("Hello " + prefix + name + " and welcome to blackJack please press the tab labeled BlackJack");
          jLabel3.setText("Welcome to you personal blackJack game " + prefix + name + " your cards are" + card1 + "(" + card1s + ") and " + card2 + "(" +card2s + ")  your hand total is " + handTotal);
        jLabel5.setText("This is where you may see the Dealers information " + prefix + name);
      private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
              handTotal = card1 + card2;
              if(handTotal > 21)
                  jLabel3.setText("You busted press hit");
                  handTotal = 0;
              handTotal = card1+card2;
              dealerHandTotal = 0;
              dealerHandTotal = dealerCard1 + dealerCard2;
              handTotal = handTotal + card3;
          jLabel3.setText("You have hit and recieve " + card3 +   "your total is " + handTotal);
                jLabel5.setText("Dealer hits and recieves " + dealerCard1 + "(" + dealerCard1s + ") and " + dealerCard2 + "(" + dealerCard2s + ")  Dealer total is " + dealerHandTotal);
        if(handTotal > 21)
          jLabel3.setText("I am sorry, you busted with: " + handTotal + "Please press hit to begin a new round");
    handTotal = 0;
          card1=card1;
          card2 = card2;
        else if( handTotal == 21)
              total =  total + (bet*2);
          jLabel3.setText("BLACKJACK!!! your total is now: " + total);
          handTotal = 0;
          dealerHandTotal = 0;
        else if(handTotal == dealerHandTotal)
            jLabel3.setText("PUSH ...house automatically wins");
                       jLabel5.setText("PUSH ...house automatically wins");
                       handTotal = 0;
                       dealerHandTotal = 0;
        else if(dealerHandTotal < 17 || handTotal > dealerHandTotal) {
                    dealerHandTotal = dealerHandTotal + dealerCard1;
        else if(dealerHandTotal == 21)
            jLabel5.setText("DEALER GETS BLACKJACK!!")
                    dealerHandTotal = 0;
            dealerHandTotal = dealerCard1+dealerCard2;
            handTotal = 0;
            handTotal = card1 + card2;
      private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        jLabel3.setText("You have stood at " + handTotal);   // TODO add your handling code here:
      private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        jLabel3.setText("You have folded at your total of: " + handTotal);
        jLabel5.setText("You have folded at you total of:" + handTotal)
        handTotal = 0;
        dealerHandTotal = 0;
      }                  Sorry i thought it would be more convenient for the code to be on another page..my bad
    Edited by: rightWingNutJob on Mar 4, 2010 2:07 PM
    Edited by: rightWingNutJob on Mar 4, 2010 2:30 PM

  • Java Swing and Socket Programming

    I am making a Messenger like yahoo Messenger using Swing and Socket Programming ,Multithreading .
    Is this techology feasible or i should try something else.
    I want to display my messenger icon on task bar as it comes when i install and run Yahoo Messenger.
    Which class i should use.

    I don't really have an answer to what you are asking. But I am developing the same kind of application. I am using RMI for client-server and server-server (i have distributed servers) communication and TCP/IP for client-client. So may be we might be able to help each other out. My email id is [email protected]
    Are you opening a new socket for every conversation? I was wondering how to multithread a socket to reuse it for different connections, if it is possible at all.
    --Poonam.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • File system using swing

    Hi,
    I am developing a standalone application using swing and awt. My requirement is to show directory structure like windows explorer. Do we have any built-in components in swing get this Done.
    Thanks
    mmb

    herez a sample code for you... not commented at all...
    import java.io.File;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.event.TreeExpansionEvent;
    import javax.swing.event.TreeWillExpandListener;
    import javax.swing.filechooser.FileSystemView;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    public class JExpTree extends JTree{
         FileSystemView fsv=null;
         File home=null;
         File[] temp=null;
         DefaultMutableTreeNode root=null;
         DefaultTreeModel treeModel=null;
         DefaultTreeCellRenderer treeRend=null;
         public JExpTree(){
              initialize();
              setModel(treeModel);
              setShowsRootHandles(true);
              addTreeWillExpandListener(new TreeWillExpandListener(){
                   public void treeWillCollapse(TreeExpansionEvent e){
                        ((DefaultMutableTreeNode)(e.getPath().getLastPathComponent())).removeAllChildren();     
                        ((DefaultMutableTreeNode)(e.getPath().getLastPathComponent())).add(new DefaultMutableTreeNode(null));     
                   public void treeWillExpand(TreeExpansionEvent e){
                        expandPath((DefaultMutableTreeNode)(e.getPath().getLastPathComponent()));
         public void expandPath(DefaultMutableTreeNode d){
              d.removeAllChildren();
              File[] tempf=((TreeFile)d.getUserObject()).getFile().listFiles();
              DefaultMutableTreeNode tempd=null;
              for(int i=0; i<tempf.length; i++){
                   tempd=new DefaultMutableTreeNode(new TreeFile(tempf));
                   if(tempf[i].isDirectory())
                        tempd.add(new DefaultMutableTreeNode(null));
                   d.add(tempd);
         public void initialize(){
              fsv=FileSystemView.getFileSystemView();
              root=new DefaultMutableTreeNode(new TreeFile(fsv.getHomeDirectory()));
              expandPath(root);
              treeModel=new DefaultTreeModel(root);
         public static void main(String a[]){
              JFrame j=new JFrame("TestFrame");
              j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              j.getContentPane().add(new JScrollPane(new JExpTree()));
              j.pack();
              j.setVisible(true);
    import java.io.File;
    import javax.swing.filechooser.FileSystemView;
    public class TreeFile {
         private File file=null;
         public TreeFile(File f){
              file=f;
         public File getFile(){
              return file;
         public String toString(){
              return FileSystemView.getFileSystemView().getSystemDisplayName(file);

  • Interactive console using Swing

    Hi,
    I am trying to implement an application administrative tool with interactive console
    (i.e. showing some info to the user and taking user input) using Swing and JDK 1.4.
    Up until now I have done info display part after selecting items from the menu
    (using JTextArea and append() ),
    but now I realized that user input has to be provided and processed.
    I don't see that I can associate an i/o stream with JTextArea. Is there a way to do that ?
    Or is there other Swing widget better suitable for that ?
    Please advise.
    Thank you in advance,
    Oleg.

    You can associate an I/O stream with the textArea using the methods,
    textArea.read(Reader reader) or the method
    textArea.write(Writer writer). These are found in the JTextArea's super class JTextComponent.
    The Reader takes and InputStream as an argument so you can use a FileInputStream to obtain a file from the user. Read more from the API documentation the classes javax.swing.text.JTextComponent and javax.swing.JTextArea.
    ICE

  • ADF – Could I have HttpSession and EJB 3 Statefull session in same applicat

    I am using JDeveloper 10.3.2. Fist I create a single demo application to create EJB Session Bean (Statefull) and is working fine.
    When I am trying to use the same EJB to my large Application a got runtime Error,
    Without any exception. (Losing the information of EJB).
    And the Question is, Shall I use HttpSession and EJB 3 Statefull session in same application?

    Hi,
    if it is a Web application you need the https session anyway and the two are different kind of beasts, one handled by teh EJB container, the other by the web container.
    The question is why you ned stateful session beans - which seems to be a rare usecase? Usually state is persisted and tracked in the business service.
    However, without an error message its hard to tell what going wrong here
    Frank

Maybe you are looking for