wood burning stoves 2.0*
The moose likes JSP and the fly likes when i retrive data from access it showing empty page in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "when i retrive data from access it showing empty page in tomcat" Watch "when i retrive data from access it showing empty page in tomcat" New topic
Author

when i retrive data from access it showing empty page in tomcat

sureshkumarneeli kumar
Greenhorn

Joined: Sep 30, 2011
Posts: 7
Hi

When I want retrive the data from ms-access it showing blank page plss give the adivce. as soon as possible.

here is the code.

this is HTML Page.


<HTML>
<HEAD>
<TITLE>Demo Project</TITLE>
<SCRIPT LANGUAGE="JavaScript">

function f(){
yr.Text="year";
t1.Text="ppo_no";
t2.Text="account_no";
}

function setShemp() {
document.getElementById('t2').readOnly='readonly';
document.getElementById("t1").removeAttribute("readonly",0);
}
function setShemp1() {
document.getElementById('t1').readOnly='readonly';
document.getElementById('t2').removeAttribute("readonly",0);
}
function setShemp2() {
document.getElementById("t1").removeAttribute("readonly",0);
document.getElementById("t2").removeAttribute("readonly",0);
}

</SCRIPT>
</HEAD>
<BODY background="bg.gif" onLoad="f()">
<img src="logo.png" width="100%" height="30%">
<marquee><font color="blue"><h1>WELCOME...!</H1></font></marquee>
<FORM name="f1" action="demo.jsp" method="POST" >
<table align="center" border="1" height="40%" width="80%">
<tr>
<td align="right">select year :      </td>
<td><select NAME="yr">
<option value="">year</option>
<option>year_2001</option><option>year_2002</option><option>year_2003</option>
<option>year_2004</option><option>year_2005</option><option>year_2006</option>
<option>year_2007</option><option>year_2008</option><option>year_2009</option>
<option>year_2010</option>
</td>
</tr><tr></tr>
<tr><td align="center" colspan="2">Ppo_no<INPUT TYPE="radio" NAME="r" onClick="setShemp()">            
Account_no<INPUT TYPE="radio" NAME="r" onClick="setShemp1()">            Both<INPUT TYPE="radio" NAME="r" checked onClick="setShemp2()"></td></tr>

<tr><td align="right">Ppo_no: <input type="text" name="t1" value="ppo_no">      </td>
<td>Account_no: <input type="text" name="t2" value="account_no"></td></tr>
<tr><td align="right"><INPUT TYPE="submit" NAME="b" VALUE="Submit">      
</td><td><input type="reset" value="Reset"></td></tr>
</table>
</FORM>
</BODY>
</HTML>


this is my jsp page.

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.lang.String.*" %>
<html>
<head>
<title>demo</title>
</head>
<body background="bg.gif">
<img src="logo.png" width="100%" height="30%">
<%!
String yr,ppo,acc,query,year,num;
Connection con;
Statement st;
ResultSet rs;
%>

<%
yr=request.getParameter("yr");
ppo=request.getParameter("t1");
acc=request.getParameter("t2");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("Jdbc:Odbc:test");

st=con.createStatement();


if(!ppo.equals("ppo_no") && !acc.equals("account_no"))
{
query="select * from "+yr+" where ppo_no='"+ppo+"' and ACC_NO='"+acc+"'";
}
else if(!ppo.equals("ppo_no"))
{

query="select * from "+yr+" where PPO_NO='"+ppo+"'";
}
else if(!acc.equals("account_no"))
{
query="select * from "+yr+" where ACC_NO='"+acc+"'";
}
else if(ppo.equals("ppo_no") && acc.equals("account_no"))
{
%>
<H3><BLINK>
please enter valid details...</BLINK></H3>
<BR><br>click here to back to <a href="demo.html"> demo page</a>
<%
}





rs=st.executeQuery(query);

%><H1>
welcome...!</H1>
<table BORDER="1" height="25%" WIDTH="100%" ALIGN="CENTER">
<tr>
<th><FONT COLOR="RED">YEAR</th>
<th><FONT COLOR="RED">MN</th>
<th><FONT COLOR="RED">BANK_CODE</th>
<th><FONT COLOR="RED">SR</th>
<th><FONT COLOR="RED">PPO_NO</th>
<th><FONT COLOR="RED">BNO</th>
<th><FONT COLOR="RED">NAME</th>
<th><FONT COLOR="RED">ACC_NO</th>
<th><FONT COLOR="RED">PEN_TYPE</th>
<th><FONT COLOR="RED">PEN_AMT</th>
<th><FONT COLOR="RED">PEN_ARR</th>
<th><FONT COLOR="RED">PEN_RLF</th>
<th><FONT COLOR="RED">CAPRT_AMT</th>
<th><FONT COLOR="RED">COMMU_AMT</th>
<th><FONT COLOR="RED">PEN_CRDT</th>
<th><FONT COLOR="RED">PNARR_CRDT</th>
<th><FONT COLOR="RED">PNRLF_CRDT</th>
<th><FONT COLOR="RED">COMMU_CRDT</th>
<th><FONT COLOR="RED">CAPRT_CRDT</th>
<th><FONT COLOR="RED">XCESS</th>
<th><FONT COLOR="RED">REMARK</th></tr>
</FONT>
<%
while(rs.next())
{%>
<TR>
<TD><%=rs.getString(2)%></TD><TD><%=rs.getString(3)%></TD>
<TD><%=rs.getString(4)%></TD><TD><%=rs.getString(5)%></TD><TD><%=rs.getString(6)%></TD>
<TD><%=rs.getString(7)%></TD><TD><%=rs.getString(8)%></TD><TD><%=rs.getString(9)%></TD>
<TD><%=rs.getString(10)%></TD><TD><%=rs.getString(11)%></TD><TD><%=rs.getString(12)%></TD>
<TD><%=rs.getString(13)%></TD><TD><%=rs.getString(14)%></TD><TD><%=rs.getString(15)%></TD>
<TD><%=rs.getString(16)%></TD><TD><%=rs.getString(17)%></TD><TD><%=rs.getString(18)%></TD>
<TD><%=rs.getString(19)%></TD><TD><%=rs.getString(20)%></TD><TD><%=rs.getString(21)%></TD><TD><%=rs.getString(22)%></TD>
</TR>

<%
}
%>
</table>
<br>go back,
<a href="demo.html" align="right">demo page</a>
<%}
catch(Exception e)
{

}
%>



Gopakumar Naryanan
Ranch Hand

Joined: Jan 15, 2011
Posts: 72

Hi ,

I think your dropdown list "yr" value is equal to "". It may be causing the problem.

Try to print the values you get from the form, it will give you clear picture where the mistake is..

As vijitha said, it's really hard to read.. please follow vijitha's instructions.


Thanks & Regards
Gopakumar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Apparently my advice on not putting Java code into JSPs that I offered in your other post has fallen on deaf ears.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when i retrive data from access it showing empty page in tomcat
 
Similar Threads
Login JSP if condition and redirecting issue
help with validation/ 2 functions on submit.
Redirecting a page
struts-2 (set values to action class)
spaces while populating using s:iterator