• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
{

}
%>



 
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently my advice on not putting Java code into JSPs that I offered in your other post has fallen on deaf ears.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!