Hi,
This example explains you to create visual for an applications.
Source code:
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*" %>
<% ArrayList alist=new ArrayList();
//String color="";
String temp[]=new String[5];
String temp1[]=new String[5];
String temp2[]=new String[5];
String temp3[]=new String[5];
String temp4[]=new String[5];
temp[0]="1";
temp[1]="aaa";
temp[2]="a.@gamil.com";
temp[3]="816 456 7890";
temp[4]="Khammam";
alist.add(temp);
//second person
temp1[0]="2";
temp1[1]="bbb";
temp1[2]="b.@gamil.com";
temp1[3]="995 446 7886";
temp1[4]="Hyderabad";
alist.add(temp1);
// Third person
temp2[0]="3";
temp2[1]="ccc";
temp2[2]="c.@gamil.com";
temp2[3]="949 333 7892";
temp2[4]="vizag";
alist.add(temp2);
//fourth person
temp3[0]="4";
temp3[1]="ddd";
temp3[2]="d.@gamil.com";
temp3[3]="970 100 2187";
temp3[4]="Sathupally";
alist.add(temp3);
//fifth person
temp3[0]="5";
temp3[1]="eee";
temp3[2]="e.@gamil.com";
temp3[3]="810 645 8675";
temp3[4]="Khammam";
alist.add(temp3);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>Addtext.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
function changecolor(id){
document.getElementById(id).style.backgroundColor="white";
}
function restorecolor(id){
var number = id;
if(number%2==0){
document.getElementById(id).style.backgroundColor="#9EACBD";
}
else{
document.getElementById(id).style.backgroundColor="#8FBDC5";
}
}
</script>
</head>
<body>
<br/><br/><br/><br/><br/>
<center> <h2> Table Grid</h2></center>
<table align=center RULES=cols FRAME=BOX CELLSPACING="0"
CELLPADDING="0" width="500" height="200" id="results">
<tr bgcolor="90AAAA">
<th>S.No</th>
<th>Name</th>
<th>Email Address</th>
<th>Phone no</th>
<th> Address</th>
</tr>
<%
for (int j = 0; j < alist.size(); j++) {
String color="";
if(j%2==0){
color="#9EACBD";}
else{
color="#8FBDC5";
}
%><tr bgcolor="<%=color %>" id="<%=j%>" onmouseover="changecolor(this.id)" onmouseout="restorecolor(this.id)">
<%
String[] row1 = (String[]) (alist.get(j));
for (int k = 0; k < row1.length; k++) {
%>
<td align="center"><%=row1[k]%>
</td><%
}
%></tr>
<%}
%> </table>
</body>
</html:html>
--------------------------------------------Thank you------------------------------------
This example explains you to create visual for an applications.
Source code:
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*" %>
<% ArrayList alist=new ArrayList();
//String color="";
String temp[]=new String[5];
String temp1[]=new String[5];
String temp2[]=new String[5];
String temp3[]=new String[5];
String temp4[]=new String[5];
temp[0]="1";
temp[1]="aaa";
temp[2]="a.@gamil.com";
temp[3]="816 456 7890";
temp[4]="Khammam";
alist.add(temp);
//second person
temp1[0]="2";
temp1[1]="bbb";
temp1[2]="b.@gamil.com";
temp1[3]="995 446 7886";
temp1[4]="Hyderabad";
alist.add(temp1);
// Third person
temp2[0]="3";
temp2[1]="ccc";
temp2[2]="c.@gamil.com";
temp2[3]="949 333 7892";
temp2[4]="vizag";
alist.add(temp2);
//fourth person
temp3[0]="4";
temp3[1]="ddd";
temp3[2]="d.@gamil.com";
temp3[3]="970 100 2187";
temp3[4]="Sathupally";
alist.add(temp3);
//fifth person
temp3[0]="5";
temp3[1]="eee";
temp3[2]="e.@gamil.com";
temp3[3]="810 645 8675";
temp3[4]="Khammam";
alist.add(temp3);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>Addtext.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
function changecolor(id){
document.getElementById(id).style.backgroundColor="white";
}
function restorecolor(id){
var number = id;
if(number%2==0){
document.getElementById(id).style.backgroundColor="#9EACBD";
}
else{
document.getElementById(id).style.backgroundColor="#8FBDC5";
}
}
</script>
</head>
<body>
<br/><br/><br/><br/><br/>
<center> <h2> Table Grid</h2></center>
<table align=center RULES=cols FRAME=BOX CELLSPACING="0"
CELLPADDING="0" width="500" height="200" id="results">
<tr bgcolor="90AAAA">
<th>S.No</th>
<th>Name</th>
<th>Email Address</th>
<th>Phone no</th>
<th> Address</th>
</tr>
<%
for (int j = 0; j < alist.size(); j++) {
String color="";
if(j%2==0){
color="#9EACBD";}
else{
color="#8FBDC5";
}
%><tr bgcolor="<%=color %>" id="<%=j%>" onmouseover="changecolor(this.id)" onmouseout="restorecolor(this.id)">
<%
String[] row1 = (String[]) (alist.get(j));
for (int k = 0; k < row1.length; k++) {
%>
<td align="center"><%=row1[k]%>
</td><%
}
%></tr>
<%}
%> </table>
</body>
</html:html>
--------------------------------------------Thank you------------------------------------
No comments:
Post a Comment