02.06.2013 Views

Thesis full text PDF - Politecnico di Milano

Thesis full text PDF - Politecnico di Milano

Thesis full text PDF - Politecnico di Milano

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4 GENERAZIONE SEMI-AUTOMATICA 4.4 Generazione Action<br />

System.err.println("DEBUG - Got null List. Problem accessing database");<br />

target = "failure" ;<br />

}<br />

<br />

//--------controlli su eventuali azioni update non implementati automaticamente<br />

<br />

target = "success" ;<br />

<br />

return (mapping.findForward(target));<br />

}<br />

private ArrayList getEmps(<br />

String <br />

<br />

, String<br />

){<br />

Connection con = null;<br />

Statement stmt = null;<br />

ResultSet rs = null;<br />

ArrayList empList = new ArrayList();<br />

StringBuffer resultString ;<br />

EmpBean emp;<br />

try{<br />

ServletCon<strong>text</strong> con<strong>text</strong> = servlet.getServletCon<strong>text</strong>();<br />

DataSource dataSource = (DataSource) con<strong>text</strong>.getAttribute(Action.DATA_SOURCE_KEY);<br />

con= dataSource.getConnection();<br />

stmt = con.createStatement();<br />

/** Access records from table emptable */<br />

<br />

StringBuffer <br />

=new StringBuffer(" ");<br />

rs = stmt.executeQuery(sqlString.toString());<br />

while (rs.next()) {<br />

emp = new EmpBean(); <br />

emp.(rs.getString( ""));<br />

<br />

empList.add(emp);<br />

}<br />

rs.close();<br />

}<br />

<br />

34 of 54

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!