The following is the front end code for searching ,
it takes data and searches from the database by the second code[b].
FRONT END CODE:
[CODE=html] <html>
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<title>
<BODY BACKGROUND="C:\ RASE\sample\blu e.jpg">
<p align="center">
<img border="0" src="C:\Documen ts and Settings\User\W ebApplication1\ web\sample\SEAR CH1.jpg" width="887" height="141" align="left">
<p align="center">
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
<form action="searchs er2.jsp" method="post">
<input type="text" name="T1" size="28">
<p align="center">
<p align="center">[font=Algerian][size=6][color=#e19117]STUDENT/ADMINISTRATOR[/color][/size][/font]
<p align="center">
</body>
</html>
[/CODE]
SECOND CODE:
[CODE=java] <%@ page import="java.sq l.*" %>
<%!
String str="";
String didmean;
String dd;
String array[];
int i;
%>
<%
str=request.get Parameter("T1") ;
didmean="%"+str +"%";
dd=str;
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("jdbc:odbc:my bean","scott"," tiger");
PreparedStateme nt st=con.prepareS tatement("selec t * from search where fname like ? or fname=? or lname=? or reg=? or year=? or dob=? or cno=? or email=? or agg=?");
st.setString(1, didmean);
st.setString(2, str);
st.setString(3, str);
st.setString(4, str);
st.setString(5, str);
st.setString(6, str);
st.setString(7, str);
st.setString(8, str);
st.setString(9, str);
ResultSet rs=st.executeQu ery();
while(rs.next() )
{
String fname1=rs.getSt ring(1);
String lname1=rs.getSt ring(2);
String reg1=rs.getStri ng(3);
String year1=rs.getStr ing(4);
String add1=rs.getStri ng(5);
String dob1=rs.getStri ng(6);
String job1=rs.getStri ng(7);
String ncompany1=rs.ge tString(8);
String jobplace1=rs.ge tString(9);
String joinedon1=rs.ge tString(10);
String sal1=rs.getStri ng(11);
String ninst1=rs.getSt ring(12);
String course1=rs.getS tring(13);
String stdplace1=rs.ge tString(14);
String coursecomp1=rs. getString(15);
String cno1=rs.getStri ng(16);
String email1=rs.getSt ring(17);
String agg1=rs.getStri ng(18);
String anyother1=rs.ge tString(19);
String option=rs.getSt ring(20);
session.setAttr ibute("firstnam e",fname1);
session.setAttr ibute("lastname ",lname1);
session.setAttr ibute("regno",r eg1);
session.setAttr ibute("yearpass ed",year1);
session.setAttr ibute("Address" ,add1);
session.setAttr ibute("dateofbi rth",dob1);
session.setAttr ibute("job",job 1);
session.setAttr ibute("namecomp any",ncompany1) ;
session.setAttr ibute("placeofj ob",jobplace1 );
session.setAttr ibute("dateofjo in",joinedon1 );
session.setAttr ibute("salary", sal1);
session.setAttr ibute("nameofin st",ninst1);
session.setAttr ibute("instcour se",course1);
session.setAttr ibute("placeofs tudy",stdplace1 );
session.setAttr ibute("completi onofcourse",cou rsecomp1);
session.setAttr ibute("contactn o",cno1);
session.setAttr ibute("emailid" ,email1);
session.setAttr ibute("aggregat e",agg1);
if(option.equal s("full"))
{
if(job1.equals( "job"))
{
out.println("<a href='detailsjo b.jsp'>"+fname1 +" "+reg1+"
");
}
else if(job1.equals( "studies"))
{
out.println("<a href='detailsst udies.jsp'>"+fn ame1+" "+reg1+"
");
}
if(job1.equals( "both"))
{
out.println("<a href='totaldeta ils.jsp'>"+fnam e1+" "+reg1+"
");
}
}
else if(option.equal s("partial"))
{
if(job1.equals( "job"))
{
out.println("<a href='pdetailsj ob.jsp'>"+fname 1+" "+reg1+"
");
}
else if(job1.equals( "studies"))
{
out.println("<a href='pdetailss tudies.jsp'>"+f name1+" "+reg1+"
");
}
if(job1.equals( "both"))
{
out.println("<a href='totaldeta ils.jsp'>"+fnam e1+" "+reg1+"
");
}
}
}
con.close();
%>[/CODE]
PROBLEM:
I want to display the results which are there in result set by using sessions.
The above mentioned second code is used to get the records from database.
SO if only one record is obtained it is giving the correct result,but if more then one is retrived it is giving the result of last session which is retrived from database.
So we want to get the apt data for the corresponding achor tag clikced on.
Kindly expecting the reply as soon as possible......
it takes data and searches from the database by the second code[b].
FRONT END CODE:
[CODE=html] <html>
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<title>
<BODY BACKGROUND="C:\ RASE\sample\blu e.jpg">
<p align="center">
<img border="0" src="C:\Documen ts and Settings\User\W ebApplication1\ web\sample\SEAR CH1.jpg" width="887" height="141" align="left">
<p align="center">
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
<form action="searchs er2.jsp" method="post">
<input type="text" name="T1" size="28">
<p align="center">
<p align="center">[font=Algerian][size=6][color=#e19117]STUDENT/ADMINISTRATOR[/color][/size][/font]
<p align="center">
</body>
</html>
[/CODE]
SECOND CODE:
[CODE=java] <%@ page import="java.sq l.*" %>
<%!
String str="";
String didmean;
String dd;
String array[];
int i;
%>
<%
str=request.get Parameter("T1") ;
didmean="%"+str +"%";
dd=str;
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("jdbc:odbc:my bean","scott"," tiger");
PreparedStateme nt st=con.prepareS tatement("selec t * from search where fname like ? or fname=? or lname=? or reg=? or year=? or dob=? or cno=? or email=? or agg=?");
st.setString(1, didmean);
st.setString(2, str);
st.setString(3, str);
st.setString(4, str);
st.setString(5, str);
st.setString(6, str);
st.setString(7, str);
st.setString(8, str);
st.setString(9, str);
ResultSet rs=st.executeQu ery();
while(rs.next() )
{
String fname1=rs.getSt ring(1);
String lname1=rs.getSt ring(2);
String reg1=rs.getStri ng(3);
String year1=rs.getStr ing(4);
String add1=rs.getStri ng(5);
String dob1=rs.getStri ng(6);
String job1=rs.getStri ng(7);
String ncompany1=rs.ge tString(8);
String jobplace1=rs.ge tString(9);
String joinedon1=rs.ge tString(10);
String sal1=rs.getStri ng(11);
String ninst1=rs.getSt ring(12);
String course1=rs.getS tring(13);
String stdplace1=rs.ge tString(14);
String coursecomp1=rs. getString(15);
String cno1=rs.getStri ng(16);
String email1=rs.getSt ring(17);
String agg1=rs.getStri ng(18);
String anyother1=rs.ge tString(19);
String option=rs.getSt ring(20);
session.setAttr ibute("firstnam e",fname1);
session.setAttr ibute("lastname ",lname1);
session.setAttr ibute("regno",r eg1);
session.setAttr ibute("yearpass ed",year1);
session.setAttr ibute("Address" ,add1);
session.setAttr ibute("dateofbi rth",dob1);
session.setAttr ibute("job",job 1);
session.setAttr ibute("namecomp any",ncompany1) ;
session.setAttr ibute("placeofj ob",jobplace1 );
session.setAttr ibute("dateofjo in",joinedon1 );
session.setAttr ibute("salary", sal1);
session.setAttr ibute("nameofin st",ninst1);
session.setAttr ibute("instcour se",course1);
session.setAttr ibute("placeofs tudy",stdplace1 );
session.setAttr ibute("completi onofcourse",cou rsecomp1);
session.setAttr ibute("contactn o",cno1);
session.setAttr ibute("emailid" ,email1);
session.setAttr ibute("aggregat e",agg1);
if(option.equal s("full"))
{
if(job1.equals( "job"))
{
out.println("<a href='detailsjo b.jsp'>"+fname1 +" "+reg1+"
");
}
else if(job1.equals( "studies"))
{
out.println("<a href='detailsst udies.jsp'>"+fn ame1+" "+reg1+"
");
}
if(job1.equals( "both"))
{
out.println("<a href='totaldeta ils.jsp'>"+fnam e1+" "+reg1+"
");
}
}
else if(option.equal s("partial"))
{
if(job1.equals( "job"))
{
out.println("<a href='pdetailsj ob.jsp'>"+fname 1+" "+reg1+"
");
}
else if(job1.equals( "studies"))
{
out.println("<a href='pdetailss tudies.jsp'>"+f name1+" "+reg1+"
");
}
if(job1.equals( "both"))
{
out.println("<a href='totaldeta ils.jsp'>"+fnam e1+" "+reg1+"
");
}
}
}
con.close();
%>[/CODE]
PROBLEM:
I want to display the results which are there in result set by using sessions.
The above mentioned second code is used to get the records from database.
SO if only one record is obtained it is giving the correct result,but if more then one is retrived it is giving the result of last session which is retrived from database.
So we want to get the apt data for the corresponding achor tag clikced on.
Kindly expecting the reply as soon as possible......
Comment