Link to home
Start Free TrialLog in
Avatar of aman0711
aman0711

asked on

generate a dynamic table on JSP page

Hi Experts,
           I am displaying the attached chart on my jsp page, Every new month is added in the X-axis as soon as the month gets populated in the Database Table.
           What I want to achieve is , Display the data (SLA Compliance column of the table) present in the chart in a tabular Form, with Column names as months, and with the addition of a new month, a new column should automatically be generated.
           Can someone please help me out with this.

           I have attached the Chart snap shot along with  a snippet of backend Table, used for this chart
           
Chart.PNG
back-Table.PNG
ASKER CERTIFIED SOLUTION
Avatar of TheVeee
TheVeee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aman0711
aman0711

ASKER

Hi Vee,
             I am very new to Java.. I never worked with JSP and Servlet. Just know a little about jsp
thats ok, we all hav to learn.. np....
What I was doing till now is this.
just the scratch..

Its giving me the first column fine as Jul, but all others vertically below it

<table border="1" cellspacing="1" bgcolor="#FFFFFF" WIDTH=99.5%>
	<tr>
		<th>Application</th>
		
 
 
	<%
		Connection conn = null;
		conn = db.getConnection();
 
		String sql = "";
		PreparedStatement pstmt = null;
		ResultSet rs = null;
 
		sql = "Select * from WEB_EXSUMM_12MONTH_APPL_V WHERE APPLICATION='ED' ORDER BY DECODE(UPPER(MONTH), 'JAN', 7, 'FEB', 8, 'MAR', 9, 'APR', 10, 'MAY', 11, 'JUN', 12, 'JUL', 1, 'AUG', 2, 'SEP', 3, 'OCT', 4, 'NOV', 5, 'DEC', 6)";
		pstmt = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
		rs = pstmt.executeQuery(sql);
		
		while (rs.next()) {
	%>
        <th align='center'><%=rs.getString(2) %></th>
     </tr>   
	<tr>
 
		<td><%=rs.getString(1)%></td>
		
		
	</tr>
 
	<%
		}
		rs.close();
		pstmt.close();
		conn.close();
	%>
 
</table>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok, I will try