<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="java.sql.*;"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home</title>
</head>
<script type="text/javascript">
function defaultfn(){
var x=document.getElementById('task');
x.disabled=true;
var y=document.getElementById('category');
y.disabled=true;
}
function enabledorpdown(){
var a = document.getElementsByName('cb');
var x=0;
for(var i=0; i<a.length; i++){
if(a[i].checked){
x=1;
break;
}
}
if(x==1){
var x=document.getElementById('task');
x.disabled=false;
var y=document.getElementById('category');
y.disabled=false;
return true;
}else{
var x=document.getElementById('task');
x.disabled=true;
var y=document.getElementById('category');
y.disabled=true;
alert('please select record');
return true;
}
return false;
}
function gofunction(){
var x = document.getElementById('status').value;
if(x!="select"){
window.location = "showData1.jsp?status="x;
}else{
alert('please select status');
}
}
</script>
<style>
.welcome{
padding-top:85px;
padding-right:20px
}
a.link1:hover {
padding-left:5px;
text-indent:1em;
color: red;
background:#fff url(http://www.example.com/myblog/images/x_ico.gif) no-repeat left center;
font-size:15px;
font-style:bold;
}
div.usertype{
padding-left: 0;
background-color: skyblue;
width: 150px ;
height: 50px;
text-align: center;
padding-top: 30px;
border: 1;
border-style: solid;
border-color: pink
}
div.usertype:hover{
font-size:20px;
font-family:sans-serif;
font-type:bold;
border:2;
border-style: inset;
border-color: blue;
}
a.link2:hover {
padding-left:5px;
text-indent:1em;
font-color: blue ;
background:#fff url(http://www.example.com/myblog/images/x_ico.gif) no-repeat left center;
font-size:20px;
font-style:bold;
}
.error{
background:#fff
}
</style>
<body onLoad="defaultfn();">
<table border="1" width="100%" height="600px">
<tr>
<td height="100px" width=100%>
<table border=1 width=100% height="100px">
<tr>
<td width=15%></td>
<td width=70%>
<table border=1 width=100% height=100px cellspacing="0px">
<tr>
<td width=20%>
</td>
<td class="welcome" width=60% align="right">
<% if(null!=session.getAttribute("username")){ %>
<a href="logout.action">Logout</a> Welcome, <%= session.getAttribute("username").toString() %>
<%}else{ response.sendRedirect("default.jsp");} %>
</td>
<td width=20% align="center" >
<table height=100px>
<tr height=50px>
<td>
</td>
</tr>
<tr>
<td height=30px>
</td>
</tr>
<tr>
<td height=20px>
<a href="http://localhost:8080/struts28/adminSearchRecord.jsp">Home</a>       
<a href="#">Setting</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width=15%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/main_db","root","dhaval");
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String qry="";
%>
<td width="100%" align="center">
<table border=1 width=100%>
<tr>
<td width="15%">
</td>
<td width="70%" align="center" height="400px">
<div align="left" style="margin-left: 100px">
<select id="task" style="">
<option value="select">-select-</option>
<option value="move">move to</option>
<option value="copy">copy to</option>
</select>
<select id="category">
<option value="select">-select-</option>
<option value="student">Student</option>
<option value="hod">HOD</option>
<option value="professor">Professor</option>
</select>
<input type="button" value="done" onclick=""></input>
</div>
<div align="left" style="margin-left: 690px;margin-top: -26px">
Status Type:
<select id="status" style="">
<option value="select">-select-</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>
<input type="button" value="Go" onclick="gofunction();"></input>
</div>
<table border=1 width="80%">
<%
if(request.getParameter("usertype").equals("viewall")){
qry = "select * from userdataviewlabelviewall";
ResultSet label_rs = st.executeQuery(qry);
ResultSetMetaData rsmd = label_rs.getMetaData();
int colcount = rsmd.getColumnCount();
label_rs.next();
int i = 1;
%>
<tr>
<td></td>
<%while(i<=colcount){ %>
<td>
<b> <%= label_rs.getString(i) %></b>
</td>
<%i++;}
label_rs.close();
%>
</tr>
<%}else if(request.getParameter("usertype").equals("student")){
qry = "select * from userdataviewlabelstudent";
ResultSet label_rs = st.executeQuery(qry);
ResultSetMetaData rsmd = label_rs.getMetaData();
int colcount = rsmd.getColumnCount();
label_rs.next();
int i = 1;
%>
<tr>
<td></td>
<%while(i<colcount){ %>
<td>
<b> <%= label_rs.getString(i) %></b>
</td>
<%i++;} label_rs.close();%>
</tr>
<%}else if(request.getParameter("usertype").equals("hod")){
qry = "select * from userdataviewlabelhod";
ResultSet label_rs = st.executeQuery(qry);
ResultSetMetaData rsmd = label_rs.getMetaData();
int colcount = rsmd.getColumnCount();
label_rs.next();
int i = 1;
%>
<tr>
<td></td>
<%while(i<colcount){ %>
<td>
<b> <%= label_rs.getString(i) %></b>
</td>
<%i++;} label_rs.close();%>
</tr>
<%}else if(request.getParameter("usertype").equals("professor")){
qry = "select * from userdataviewlabelprofessor";
ResultSet label_rs = st.executeQuery(qry);
ResultSetMetaData rsmd = label_rs.getMetaData();
int colcount = rsmd.getColumnCount();
label_rs.next();
int i = 1;
%>
<tr>
<td></td>
<%while(i<colcount){ %>
<td>
<b> <%= label_rs.getString(i) %></b>
</td>
<%i++;} label_rs.close();%>
</tr>
<%}%>
<% if(request.getParameter("usertype").toString().equals("viewall")){
System.out.println(request.getParameter("usertype").toString());
session.setAttribute("usertype1",request.getParameter("usertype").toString());
System.out.println(session.getAttribute("usertype1"));
qry = "select * from userdataviewall";
ResultSet rs = st.executeQuery(qry);
ResultSetMetaData rsmddata = rs.getMetaData();
int colcount1 = rsmddata.getColumnCount();
System.out.println("colcoutn"+colcount1);
%>
<%
while(rs.next()){ System.out.println("in begining");
int i1=1;
%>
<tr>
<td>
<input onChange="enabledorpdown();" name="cb" type="checkbox" id="<%=rs.getString("username")%>" value="<%=rs.getString("username")%>"></input>
</td>
<% while(i1<=colcount1){
System.out.println(i1);%>
<td>
<% if(rs.getString(i1).toString().equals("true")||rs.getString(i1).toString().equals("false")){ %>
<% if(rs.getString(i1).toString().equals("false")){
%>
<img alt="" src="false.png">
<%}else{%>
<img alt="" src="yes.png">
<%}%>
<%}else{ %>
<%= rs.getString(i1) %>
<%} %>
</td>
<%i1++; } %>
</tr>
<%}%>
<%}else if(request.getParameter("usertype").toString().equals("student")){
qry = "select * from userdataviewstudent";
ResultSet rs = st.executeQuery(qry);
ResultSetMetaData rsmddata = rs.getMetaData();
int colcount1 = rsmddata.getColumnCount();
System.out.println("colcoutn"+colcount1);
%>
<%
while(rs.next()){ System.out.println("in begining");
int i1=1;
%>
<tr>
<td>
<input name="cb" type="checkbox" onclick="enabledropdown();" id="<%=rs.getString("username")%>" value="<%=rs.getString("username")%>"></input>
</td>
<% while(i1<colcount1){
System.out.println(i1);%>
<td>
<%= rs.getString(i1)%>
</td>
<%i1++; } %>
</tr>
<%}%>
<%}else if(request.getParameter("usertype").toString().equals("hod")){
qry = "select * from userdataviewhod";
ResultSet rs = st.executeQuery(qry);
ResultSetMetaData rsmddata = rs.getMetaData();
int colcount1 = rsmddata.getColumnCount();
System.out.println("colcoutn"+colcount1);
%>
<%
while(rs.next()){ System.out.println("in begining");
int i1=1;
%>
<tr>
<td>
<input name="cb" onclick="enabledropdown();" type="checkbox" id="<%=rs.getString("username")%>" value="<%=rs.getString("username")%>"></input>
</td>
<% while(i1<colcount1){
System.out.println(i1);%>
<td>
<%= rs.getString(i1)%>
</td>
<%i1++; } %>
</tr>
<%}%>
<%}else if(request.getParameter("usertype").toString().equals("professor")){
qry = "select * from userdataviewprofessor";
ResultSet rs = st.executeQuery(qry);
ResultSetMetaData rsmddata = rs.getMetaData();
int colcount1 = rsmddata.getColumnCount();
System.out.println("colcoutn"+colcount1);
%>
<%
while(rs.next()){ System.out.println("in begining");
int i1=1;
%>
<tr>
<td>
<input name="cb" onclick="enabledropdown();" type="checkbox" id="<%=rs.getString("username")%>" value="<%=rs.getString("username")%>"></input>
</td>
<% while(i1<colcount1){
System.out.println(i1);%>
<td>
<%= rs.getString(i1)%>
</td>
<%i1++; } %>
</tr>
<%}%>
<%}%>
</table>
</td>
<td width="15%">
</td>
</tr>
</table>
</tr>
<tr>
<td align="center" height="50px">
Copyright © 2012 Perfect Computer ! Inc. All Rights Reserved
</td>
<%
st.close();
con.close();
%>
</tr>
</table>
</body>
</html>
Hi dhaval28 and welcome to the forums,
From what I can see the reason your code isn’t working is because your markup is invalid, currently your <script> and <style> tags sit outside of your <head> tags which will render the elements pretty much useless, simply put them back inside the <head> tags and it should work fine.