How to get the value from bean for another class in java
<p>I am setting the value  for java bean in one class. how to get the value in another class can anybody give example ?</p>

<pre><code>import java.util.ArrayList;

public class HomeBean {
    String indexname="";
    String lastvalue="";    
    String changepercentage="";
    ArrayList aindexname=new ArrayList();
    ArrayList alastname=new ArrayList();
    ArrayList alastpercentage=new ArrayList();
    public String getIndexname() {
        return indexname;

    }
    public void setIndexname(String indexname) {
        this.indexname = indexname;
        System.out.println("******index name is *****"+indexname);
        aindexname.add(indexname);

    }

    public String getLastvalue() {
        return lastvalue;
    }
    public void setLastvalue(String lastvalue) {
        this.lastvalue = lastvalue;
    }
    public String getChangepercentage() {
        return changepercentage;
    }
    public void setChangepercentage(String changepercentage) {
        this.changepercentage = changepercentage;
    }
    public ArrayList getArrayListIndexName()
    {
        for(int i=0;i&lt;aindexname.size();i++)
        {
        System.out.println("####indexname is######"+aindexname.get(i).toString());
        }   

     return aindexname; 
    }

    public ArrayList getArrayListLastValue()
    {
     return alastname;

    }

    public ArrayList getArrayListChangePercentage()
    {

     return alastpercentage;    
    }




}
</code></pre>

<p>setting the value in one class</p>

<pre><code> mport java.util.ArrayList;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class DomTableParser
{

 ArrayList listTable=new ArrayList();
    public ArrayList parseXmlFile(String tableservicevalue){
        //get the factory
     Document doc;  
            StringtoDocument stdoc=new  StringtoDocument();
              doc=stdoc.getDocument(tableservicevalue);

              //System.out.println("Information of all employees");


                HomeBean bean=new HomeBean();
            Element docEle = doc.getDocumentElement();




            NodeList indexNode = docEle.getElementsByTagName("INDEX");
            if(indexNode != null &amp;&amp; indexNode.getLength() &gt; 0) 
            {
                for(int i = 0 ; i &lt; indexNode.getLength();i++)
                {
                    Element homeElmnt = (Element)indexNode.item(i);

                     DomParserTableDataSet dataSet=new DomParserTableDataSet();
                       String indexName = homeElmnt.getAttribute("INDEX_NAME");
                        String lastValue=homeElmnt.getAttribute("LAST_VALUE");      
                        String changePercentage=homeElmnt.getAttribute("CHANGE_PERCENTAGE");
                        //String questgroupid=loginElmnt.getAttribute("ID");
                        bean.setIndexname(indexName);
                        bean.setLastvalue(lastValue);
                        bean.setChangepercentage(changePercentage);
                        bean.getArrayListIndexName();
                        dataSet.setIndexName(indexName);
                         dataSet.setLastValue(lastValue);
                         dataSet.setChangePercentage(changePercentage);
                          listTable.add(dataSet);



                }
            }


        return listTable;
    }




}
</code></pre>
