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

  • SEARCH
  • Home
  • 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 9156551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:48:05+00:00 2026-06-17T12:48:05+00:00

public void getEvent(String tableClick) { Events e = new Events(); try { pst =

  • 0
    public void getEvent(String tableClick) {

    Events e = new Events();
    try {
        pst = conn.prepareStatement("SELECT * FROM Event WHERE eventID='"+tableClick+"' ");
        rs = pst.executeQuery();
        while(rs.next()){      
        e.setEventName(rs.getString(2));
        System.out.println(rs.getString(2));
        e.setEventDate(rs.getDate(3));
        e.setEventTime(rs.getString(4));
        e.setEventVenue(rs.getString(5));
        e.setEventDetail(rs.getString(6));
        e.setEventOpportunity(rs.getString(7));
        e.setEventMoreDetails(rs.getString(8));
        e.setEndTime(rs.getString(9));
        rs.close();
        pst.close();
       }
    } 
    catch(SQLException ex){
    ex.printStackTrace();
    } 
} //end getEvent

Whilst the System.out.println(rs.getString(2) print a value from database, I am unable to populate this information in my bean.

I am using mutators to populate the JavaBean, but when I try to use the accessors in my View class of the MVC framework, it displays null.

Here is my Call from VIEW class

Method in VIEW class

     public void changeDisplay() {
       Events e = new Events();
       evTitle.setText(""+e.getEventName());
       evWhen.setText("When: "+ e.getEventDate());
       evWhere.setText("Where: "+ e.getEventVenue());
       evDescription.setText("Description: "+ e.getEventDetail());
       evOpportunity.setText("Opporunity: "+ e.getEventOpportunity());
       evMoreDet.setText("More Details: "+ e.getEventMoreDetails());
   }
  • 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-06-17T12:48:06+00:00Added an answer on June 17, 2026 at 12:48 pm

    This code can’t work… Why do you have a method called getEvent with a void return type? What you want is probably something like that :

    public Event getEvent(String tableClick) {
    Events e = new Events();
    try {
        pst = conn.prepareStatement("SELECT * FROM Event WHERE eventID='"+tableClick+"' ");
        rs = pst.executeQuery();
        while(rs.next()){      
        e.setEventName(rs.getString(2));
        System.out.println(rs.getString(2));
        e.setEventDate(rs.getDate(3));
        e.setEventTime(rs.getString(4));
        e.setEventVenue(rs.getString(5));
        e.setEventDetail(rs.getString(6));
        e.setEventOpportunity(rs.getString(7));
        e.setEventMoreDetails(rs.getString(8));
        e.setEndTime(rs.getString(9));
        rs.close();
        pst.close();
        return e;
       }
    } catch(SQLException ex) {
        ex.printStackTrace();
        return null;
    } 
    
    } //end getEvent
    

    I don’t know how your code is working but you probably want to called that method from the view and then display the value. Your changeDisplay method is displaying null because you just created the object…

    You probably need something like :

    public void changeDisplay(Events e) {
        evTitle.setText(""+e.getEventName());
        evWhen.setText("When: "+ e.getEventDate());
        evWhere.setText("Where: "+ e.getEventVenue());
        evDescription.setText("Description: "+ e.getEventDetail());
        evOpportunity.setText("Opporunity: "+ e.getEventOpportunity());
        evMoreDet.setText("More Details: "+ e.getEventMoreDetails());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public void populateNotesFromFile() { try{ BufferedReader reader = new BufferedReader(new FileReader(DEFAULT_NOTES_SAVED)); String fileNotes =
public void GrabData() throws IOException { try { BufferedReader br = new BufferedReader(new FileReader(data/500.txt));
public void EditAndSave(String fileName) { Bitmap b = new Bitmap(fileName); /** * Edit bitmap
I have problem with ObjectContext.SaveChanges method: public void Save(Action<object, object> action) { EventAggregator.GetEvent<EntityServiceRequestingEvent>().Publish(true); var
public void openOptions() { Intent intent=new Intent(this,Game.class); //intent.putExtra(razmer, level); startActivity(intent); // Intent intent=new Intent(this,Options.class);
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Init(); backthread tr=new backthread(); tr.execute(0,0,0); } backthread
public void LoadAveragePingTime() { try { PingReply pingReply = pingClass.Send(logon.chronic-domination.com); double AveragePing = (pingReply.RoundtripTime
public void LoadRealmlist() { try { File.Delete(Properties.Settings.Default.WoWFolderLocation + Data/realmlist.wtf); StreamWriter TheWriter = new StreamWriter(Properties.Settings.Default.WoWFolderLocation
public void handleParsedCommand(String[] commandArr) { if(commandArr[0].equalsIgnoreCase(message)) { int target = Integer.parseInt(commandArr[1]); String message =
public void wahey(List<Object> list) {} wahey(new LinkedList<Number>()); The call to the method will not

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.