Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3407292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:43:59+00:00 2026-05-18T05:43:59+00:00

I am setting the value for java bean in one class. how to get

  • 0

I am setting the value for java bean in one class. how to get the value in another class can anybody give example ?

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<aindexname.size();i++)
        {
        System.out.println("####indexname is######"+aindexname.get(i).toString());
        }   

     return aindexname; 
    }

    public ArrayList getArrayListLastValue()
    {
     return alastname;

    }

    public ArrayList getArrayListChangePercentage()
    {

     return alastpercentage;    
    }




}

setting the value in one class

 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 && indexNode.getLength() > 0) 
            {
                for(int i = 0 ; i < 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;
    }




}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:44:00+00:00Added an answer on May 18, 2026 at 5:44 am

    I would recommend you to read Variable Scope doc from sun

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am setting a cookie Request.Cookies(TemplateName).value on one of my pages(page 3) of my
Does Java have the possibility of anonymous enums? For example, I want my class
I am setting the values of a java bean from a jsp page which
Why can't java gracefully return some value with a division by zero and instead
I'm looking for help setting a new default property value for an inherited control
I am having a problem setting the Authorize attribute Role value from a variable.
In SQL, how do update a table, setting a column to a different value
I believe I understand what Java Beans are: Java class(es) which contain a no-arg
What is the most efficient way of setting values in C# multi-dimensional arrays using
Is it possible? By debug I mean setting breakpoints, inspect values and advance step

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.