Friends,
I am facing a problem, when i run this code It will not work. it is just show blank page.
Thanks in advance
kandarp
***This is test.jsp
<jsp:useBean id="sdb" scope="page" class="common.SupportDB"/>
<link rel="stylesheet" type="text/css" href="style.css">
<html>
<head>
<title>Gujarat Print Pack</title>
</head>
<body>
<%
String hold_user = request.getParameter("id");
String hold_str1 = request.getParameter("str");
String hold_id = request.getParameter("D1");
int hold_str = Integer.parseInt(hold_str1);
if(hold_id=="OrderID"){
if(sdb.IsValidRecord("Orders", "OrderID",hold_str)){
%>
<jsp:forward page="MainOrderDetails.jsp">
<jsp
aram name="orderid" value="<%=hold_str%>"/>
</jsp:forward>
<%
}
%>
<%=hold_str%> Not Found.
<%
}
if(hold_id=="JobID"){
if(sdb.IsValidRecord("JobName", "JobNameID", hold_str)){
%>
HELLO HOW ARE YOU???
<jsp:forward page="MainJobDetails.jsp">
<jsp
aram name="jobid" value="<%=hold_str%>"/>
</jsp:forward>
<%
}
%>
<%=hold_str%> Not Found.
<%
}
%>
There is some Error............
</body>
</html>
***** JAVA Bean
package common;
import common.*;
import java.sql.*;
import java.util.*;
public class SupportDB{
private Connection con;
private Statement st;
private ResultSet rs;
public void getConnection(){
try{
Class.forName ("org.gjt.mm.mysql.Driver");
con=DriverManager.getConnection("jdbc:mysql:///gujarat_gpp?user=gujarat&password=gck007&autoReconnect=true");
}catch(Exception e){
System.out.println("SupportDB - getConnection() : ");
e.printStackTrace();
}
} // getConnection(), method
public boolean IsValidRecord(String TableName, String srchField, int hold_str){
boolean result = false;
String retVal = null;
try{
getConnection();
st=con.createStatement();
String qry = "select * from "+TableName+" where "+srchField+" = "+hold_str;
rs=st.executeQuery(qry);
if(rs.next()){
retVal = rs.getString(srchField);
if(Integer.parseInt(retVal)==hold_str){
result=true;
}
}
rs.close();
st.close();
con.close();
}catch(Exception e){
System.out.println("SupportDB - boolean IsValidRecore() : ");
e.printStackTrace();
}
return result;
}//end of public boolean IsValidRecore()
} // SupportDB, class