Hi, I just want to get a collection of rows from a database and put them in a 
form.
   
  I created a simple bean Vote.java
  public class Vote {
protected String ticketid;
protected String title;
protected String vote;
  public void setTicketid(String tid) {
this.ticketid = tid;
}
public String getTicketid() {
return ticketid;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setVote(String priority) {
this.vote = vote;
}
public String getVote() {
return this.vote;
}
}
   
  _____________________________________________________
  and the Action ,
  ______________________________________________________
  public ComplianceAction() {
        System.out.println("Compliance Action");
    }
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws Exception{
        
                     ArrayList votes = getVotes(); ???
                    return mapping.findForward("success");
               
        
    }
    
   protected ArrayList getVotes() {
    Vote  vote = null;
    ArrayList votes = new ArrayList();
     Statement stmt = null;
     ConnectionDb condb = null;
     
     try {
            condb = new ConnectionDb();
             Connection con = condb.getConnection ();
            stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("select v.TICKET_ID, t.TITLE, 
v.VOTE"
                                   + " from cons_voting_det v, pt7bt_ticket t"
                                   + " where v.COEUS_RELEASE = '4.4' and "
                                   + " v.SUB_COMM = 'Compliance' and"
                                   + " v.USER_ID = 'majid' and"
                                   + " v.TICKET_ID = t.TICKET_ID order by 
v.TICKET_ID;" );
   while ( rs.next() ) {
vote = new Vote();
vote.setTicketid(rs.getString("TICKET_ID"));
vote.setTitle(rs.getString("TITLE"));
vote. setVote(rs.getString("VOTE"));
votes.add(vote);
System.err.println("TICKET_ID : "
+ vote.getTicketid()
+ "TITLE :" + rs.getString("TITLE"));
}           
} catch ( SQLException se ) {
            se.printStackTrace();
        } catch ( Exception e ) {
            e.printStackTrace();
        }
        finally {
            try {
                stmt.close();
                condb.releaseConnection();
             
            } catch ( Exception e ) { }
        } 
       return votes;
   }
         
}

   
  I read but get confused, that I have to create a dynaform that will be a 
collection of beans (Vote.java) ...///
   
  How I am gonna do it in my Action class instead of returning ArrahList ?
   
  Thanks, your help is appreciated.
   

       
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 

Reply via email to