Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

please figure this out..

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyone help me sort out this.
i have a search page with 2 input fields name and lastname that generate the next jsp page which displays the matching records and corresponding to them i have given a drop down year menu. Now , on choosing from the year and then clicking on the name the values for that particular year and for that name are generated.
my code is like this:
<%
Connection con=null;
java.sql.Statement stmt=null;
ResultSet rs=null;

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc dbc:mech_iit");
stmt = con.createStatement();
String fname=request.getParameter("fname").toUpperCase();
String lname=request.getParameter("lname").toUpperCase();
String mainquery="";
String subquery="";
int count=0;
String Desg="";

if(!fname.trim().equals(""))
{
subquery=" upper(fname) like '%"+fname+"%'";
}

if(!lname.trim().equals(""))
{
if(subquery.length()>10)
subquery = subquery + " and ";
subquery = subquery + " upper(lname) like '%"+lname+"%'";
}
mainquery="select fname,lname,Desg,user_login from login where "+subquery+"";

rs=stmt.executeQuery(mainquery);
while(rs.next())
{
count++;
fname = rs.getString("fname");
lname = rs.getString("lname");
Desg=rs.getString("Desg");

%>


<form name="form1" method="post">
<table align="center" border=1 cellspacing=3>
<tr>
<tr>
<tr bordercolor="#000000">
<td bgcolor="#FFFFCC" value="name"><a href ="my_page.jsp?user_login=09090"><%=fname+" "+lname %></a></td>
<td bgcolor="#FFFFCC" value="desg"><%=Desg%></td>
</tr>
<td bgcolor="#FFFFCC"> Year </td>
<td align="middle" bgcolor="#FFFFCC" width="52%">
<select name="year">
<option value="01">2003</option>
<option value="02">2002</option>
<option value="04">2000</option>
<option value="05">1999</option>
</select>
</td>
</tr>
</table>
<p> </p>
<p> </p>
</form>
<%
}
if(count==0)
{
{
out.println("<p><b> No Record Found</b></p>");
}
}
}



catch(Exception e)
{
System.out.println(e);
}
%></table>

Wanted to know that in the next page where the user records are generated how do i display the users records on clicking on his name.
thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic