Example list dynamically loaded from a Java servlet
The example below is working on the site Hostingjava
In this example, a servlet writes the HTML field Listestr (list of extractions)
out.println ("select name = \\" Listestr \\ "size = \\" 1 \\ "");
definition of a result set from mysql to read all these dates DTEs DTEs on the table in descending order (DTEs table extraction Lot)
DTEs = data extraction
rs = stmt.executeQuery
("SELECT DTEs"
+ "FROM DTEs"
+ "ORDER BY DTEs DESC");
while (rs.next ()) {/ / reading the entire table
Date dtesel rs.getDate = (1); / / set the date
sdf.format result2 = (dtesel) / / convert from string to Date and the "run"
if (result2.compareTo (estrdel)! = 0) / / compare the data with a previous
{out.println ("");}
else {out.println ("");}}
rs.close ();
rs = null;
nb field contains all occurrences option selected, and is written in two ways: one normal if no date had been chosen (first viewing / processing), so SELECT to display the date selected.
dtesel is read by the date mysql date formats
result2 is the same due date as a string shot from YYYYMMDD to dd.mm.yyyy with SimpleDateFormat sdf = new SimpleDateFormat ("dd.mm.yyyy");
How
read the date selected from the list:? In
Method doPost intercept any choice made
String list = request.getParameter ("Listestr") / / Verify choice of entry
if (list! = Null) {estrdel = list;} / / set the field estrdel
0 comments:
Post a Comment