-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsp.jsp
32 lines (31 loc) · 1.07 KB
/
jsp.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<%@ page import="stockanalysis.*"%>
<%@ page import="java.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html >
<html>
<head>
<title>Top Gainers</title>
</head>
<body>
<jsp:useBean id="currentdetails" class="stockanalysis.CurrentDetails" />
<%
Connection con = GetDBConnection.getConnection("STOCKT_NSE");
Statement stmt = con.createStatement();
String query ="SELECT * FROM gainlose where percent_chng > 0 order by percent_chng desc";
ResultSet rs = stmt.executeQuery(query);
while(rs.next()){
String ticker = rs.getString(1);
double chng = rs.getDouble(2);
double percentchng = rs.getDouble(3);
String query1 = "SELECT companyname from TNC WHERE TICKER = '"+ticker+"'";
ResultSet rs1 = stmt.executeQuery(query1);
String companyName = new String();
if(rs1.next())
companyName = rs1.getString(1);
%>
<h3><%=companyName %>   <%=ticker %></h3>   <img class="arrow" src="up.jpg"/>
<h3 style="color: green"><%=currentdetails.close %> <%=chng %> (<%=percentchng %>%)</h3>
<% } %>
</body>
</html>