• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

java.lang.UnsupportedOperationException while getting data from database in JSF

 
Greenhorn
Posts: 14
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.

I am getting java.lang.UnsupportedOperationException while storing the data into arraylist from database.

My code is....




public List displayNotice() throws SQLException, ClassNotFoundException
{

Class.forName("com.mysql.jdbc.Driver");
Connection con1=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase","root","root");

Statement st=con1.createStatement();
ResultSet rs=st.executeQuery("select noticedate, notice from mytable");
while(rs.next())
{
Notice note = new Notice();
note.setToday(rs.getString(1));
note.setEditor(rs.getString(2));



try
{
arrList.add(note);


}catch(Exception e)
{
e.printStackTrace();
}
return arrList;

}



It showing the above exception for add() fuction, due to which I am not able to get the data from database.

Help Please...
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is your List object it doesn't support the "add" method?
Where are you getting the value of arrList from?

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic