I have a String that holds the value of an ID number from a query that I am parsing into an Integer. I need a FOR loop that checks every time a certain number appears in the query more than five times. I am displaying this information on a JSP page.
So far I have:
while (rs1.next()){
String TicketNumber = rs1.getString("XXXXX_XXXXX_NO");
String MUID = rs1.getString("XXXXXX_XXXX");
String Name = rs1.getString("XXXXXXX_XXXXX_NAME");
String LastName = rs1.getString("XXXXX_XXXX_NAME");
int PIDM = Integer.parseInt(MUID);
for ( int n = 0, n >= 5, n += 1 )
rs1 is the statement that I am quering and I am setting these values, parsing out the MIUD into PIDM but I am not quite sure where to go from there.
Just make use of the powerful aggregate functions the SQL offers you on that area:
in combination with
Or if you’re actually interested in the non-aggregated information, then best is indeed to use a
Map<Integer, Integer>or maybe betterMap<Integer, List<Ticket>>so that you can just display it in JSP at once nicely using JSTLc:forEach. You can then get the size ofList<Ticket>using JSTLfn:length.E.g.