Results 1 to 6 of 6

Thread: Access to Objects In A JavaBean From Another Java Bean

  1. #1
    Join Date
    Nov 2009
    Posts
    117

    Access to Objects In A JavaBean From Another Java Bean

    Hello, I want to perform one program which can get access of the one javabean object from another java bean. I have tried many things but failed to implement it and also don't find anything on internet about it. If anyone is having solution for it, then please provide me help on it. So, that I can Access to Objects In A Bean From Another Java Bean.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Access to Objects In A JavaBean From Another Java Bean

    Hello, you can make use of the coding of this JSP page as below:
    Code:
    package test;
    Public class prson 
    {
      Private String Title;
      Private String Title1;
      Public prson() 
    {
        this.Title = "default Title";
        this.first_Title = "first_Title default";
      }
        Public void setNom (String Title) 
    {
        this.Title = Name;
      }
        Public String getName() 
    {
        return (this.Title);
      } 
      Public void setPrenom (String Title1) 
    {
        this.first_Title = FirstTitle;
      }
       Public String getPrenom () 
    {
        return (this.first_Title);
      }
    }

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Access to Objects In A JavaBean From Another Java Bean

    Hello, you can make use of the code below:
    Code:
    <jsp: useBean id ="Person" scope ="request" class="test.Personne" />
    <html>
    <HEAD>
    <TITLE> Test d'instantiation ofa bean in a JSP </ TITLE>
    </ HEAD>
    <body>
    <p> Test dthe use ofa Bean in a JSP </ p>
    <p> Soruce = <% = person.getName() %> </ p>
    <p> After updation  = <% = person.getName() %> </ p>
    </ Body>
    </ html>

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Access to Objects In A JavaBean From Another Java Bean

    I think you may need to make use of the books below:
    • Java Language Specification: Third Edition
    • Java Native Interface: Programmer's Guide and Specification
    • Core Servlets and JavaServer Pages (JSP)
    • Thinking in Java - Bruce Eckel's renowned book
    • Advanced Programming for the Java 2 Platform

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Access to Objects In A JavaBean From Another Java Bean

    You can solve your problem by looking the code below:
    Code:
    <html>
    <HEAD>
    <TITLE> Test d'instantiation ofa bean in a JSP </ TITLE>
    </ HEAD>
    <body>
    <p> Test dthe use ofa Bean in a JSP </ p>
    <p> Soruce = <bean: write name ="Person" property ="name" scope ="request"/> </ p>
    <p>After Updation  = <bean: write name ="Person" property ="firstname" scope ="request"/> </ p>
    </ Body>
    </ html>

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Access to Objects In A JavaBean From Another Java Bean

    Hello, The bean page below will simply solve your problem. You just need to use it in your program.
    Code:
    package obia.ajax; 
    import javax.servlet.http.HttpSessionBindingEvent;
    import javax.servlet.http.HttpSessionBindingListener;
    Public class Testing implements HttpSessionBindingListener
    {
        Private String Testing;
        
        Public Testing()
        {
            great();
        } 
        Public String getName()
        {
            return Testing;
        } 
        Public void setName(String Testing)
        {
            this.Testing = Name;
        }
        Public void valueBound(HttpSessionBindingEvent argument)
        {
            String app = (String)argument.getSession().getServletContext().getAttribute("APPLICATION_NAME");
            if (app == null)
            {
                app = "Reserved";
                argument.getSession().getServletContext().setAttribute("APPLICATION_NAME", ApplicationName);
            }
            Testing = app;
        }
        Public void valueUnbound(HttpSessionBindingEvent argument)
        {
        }
    }

Similar Threads

  1. How to create a java bean for jsp in order to access database
    By K@ttY in forum Software Development
    Replies: 2
    Last Post: 21-01-2012, 10:00 AM
  2. Convert a Java Bean Code
    By KALYAN23 in forum Software Development
    Replies: 5
    Last Post: 02-08-2010, 10:34 AM
  3. How to create an instance of Bean in java?
    By Madaleno in forum Software Development
    Replies: 4
    Last Post: 03-02-2010, 09:33 PM
  4. Difference between Java Class and Bean
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 01-02-2010, 01:28 PM
  5. Don't know how to run the java bean program
    By Reema_n in forum Software Development
    Replies: 5
    Last Post: 23-12-2009, 11:01 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,702,966.81269 seconds with 17 queries