hello,
This is my code, If I will run this Program 10 -20 times I don't get what
will happened . But the Responce become slow.
I have Unix plateform and Informix as a server.
This is selection screen. After that I have to run the report regarding
criteria.
Thanks for help,
<%@ page import="java.util.*,java.sql.*,java.lang.*" %>
<%@ include file="Connection.jsp" %>
<HTML><BODY >
<form name="frmMisRep" method=post action= "ProductCriteria.jsp" >
<%
String salesQry="",productQry="",sortQry="",shadeQry="",reportStr="";
String appendStr=""; boolean flag=true;
ResultSet rsSales=null,rsProduct=null,rsSort=null,rsShade=null;
String spno="",salesDescription="";String ppno="",productDescription
="";
int sortno=0;String shadeno="";
String param1="",param2="",param3="",param4="",param="";
String first="",second="",third="",forth=""; int md = 1;int
sort=0;
param1=nulltostring(request.getParameter("salesno"));
param2=nulltostring(request.getParameter("productno"));
param3=nulltostring(request.getParameter("sortno"));
param4=nulltostring(request.getParameter("shadeno"));
String control ="";
control=nulltostring(request.getParameter("count"));
if (control.equals("1")){ md =1; }else{ }
out.println(param1);String third1= "";int test=0;
if(md == 1){
if (param1.equals("") || param1.equals("All")){
first="";
}else{
appendStr=" and b.sp_no='"+param1+"'";
first = " where sp_no='"+param1+"'";
}
session.putValue("first",param1);
if (param2.equals("") || param2.equals("All")){
second="";
}else{
appendStr +=" and b.pp_no='"+param2+"'";
second = " where pp_no='"+param2+"'";
test=2;
}
session.putValue("second",param2);
if (param3.equals("") || param3.equals("All")){
third="";
}else{
appendStr +=" and sort="+param3;
if(second.equals("")){
third = " Where sort="+param3;
}else{
third = second +" and sort="+param3;
}}
session.putValue("third",param3);
if (param4.equals("") || param4.equals("All")){
}else{
appendStr +=" and match="+param4;
}
session.putValue("forth",param4);
}
%>
<table border=1 width="60%" align=center><tr><td>
<table width="100%" align = center>
<tr><td align=right width="50%">Sales Order </td>
<%
try{
salesQry="Select sp_no,description from sp_hdr";
rsSales = st.executeQuery(salesQry);
}
catch(SQLException se){
st.close();
rsSales.close();
out.println("Error in the Sales");
se.getMessage();
con.close();
}
%>
<td align=left><select name=salesorder
onchange=FillValue(this.options.value,1) width=25 size=1>
<option value='All' selected>ALL</option>
<% while(rsSales.next()){
spno = rsSales.getString("sp_no");
salesDescription =rsSales.getString("description");
if(param1 == null || param1 == ""){%>
<option value="<%=spno%>" ><%=spno%>
(<%=salesDescription%>)</option>
<%}else{
if(param1.equals(spno)){%>
<option value="<%=spno%>" selected><%=spno%>
(<%=salesDescription%>)</option>
<%}else{%>
<option value="<%=spno%>"><%=spno%>
(<%=salesDescription%>)</option>
<%}}}
rsSales.close() ;%>
</select></td></tr>
<tr><td align=right>Production Order</td>
<%try{
productQry="Select pp_no,description from pp_hdr" +
first;
rsProduct = st.executeQuery(productQry);
}catch(Exception se){
st.close();
rsProduct.close();
out.println("Error in the product");
se.getMessage();
con.close();
}%>
<td align=left><select name=productlist
onchange=FillValue(this.options.value,2) width=25 size=1>
<option value= 'All' selected> ALL</option>
<%
while(rsProduct.next()){
ppno = rsProduct.getString("pp_no");
productDescription =rsProduct.getString("description");
if(param2 == null || param2 == ""){%>
<option value="<%=ppno%>" ><%=ppno%>
(<%=productDescription%>)</option>
<%}else{
if(param2.equals(ppno)){
%><option value="<%=ppno%>"selected><%=ppno%>
(<%=productDescription%>)</option>
<%}else{%>
<option value="<%=ppno%>"><%=ppno%>
(<%=productDescription%>)</option>
<%}}}
rsProduct.close();
%></select></td></tr>
<tr><td align=right>Sort No </td>
<td align=left> <%
try{ sortQry="Select distinct sort from pp_det"+second;
rsSort = st.executeQuery(sortQry);
} catch(SQLException se){
st.close();
rsSort.close();
out.println("Error in the Sort");
se.getMessage();
con.close();
} %>
<select name=sortlist onchange=FillValue(this.options.value,3)
width=25 size=1>
<option value='All' selected> ALL</option>
<% String s="";
while(rsSort.next()){
s= rsSort.getString("sort");
if(param3.equals(s)){%>
<option value="<%=s%>" selected><%=s%></option>
<%}else{%>
<option value="<%=s%>" ><%=s%></option>
<%}}
rsSort.close();%>
</select></td></tr>
<tr><td align=right>Shade No</td><%
try{ shadeQry="Select distinct match from pp_det"+ third;
rsShade= st.executeQuery(shadeQry);
} catch(SQLException se){
st.close();
rsShade.close();
out.println("Error in the Shade");
se.getMessage();
con.close();
}%>
<td align=left><select name=shadelist size=1
onchange=FillValue(this.options.value,4) noresize>
<option value= 'All' selected > ALL</option>
<%
while(rsShade.next()){
shadeno= rsShade.getString("match");
if(param4.equals(shadeno)){
%><option value="<%=shadeno%>" selected>
<%=shadeno%></option> <%
}else{%>
<option value="<%=shadeno%>"><%=shadeno%></option><%} }
rsShade.close();
%> </select></td></tr><tr></tr></table>
<%{
session.putValue("AppendString",appendStr);
st.close();
con.close();
}%>
</form></BODY></HTML>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com