wood burning stoves 2.0*
The moose likes Servlets and the fly likes Cache Problem in Jsp... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cache Problem in Jsp..." Watch "Cache Problem in Jsp..." New topic
Author

Cache Problem in Jsp...

gajanan deshpande
Greenhorn

Joined: Jun 30, 2001
Posts: 18
Hi All,
I am comming to contactdetails.jsp from two ways,either from add_party.jsp or Edit supplier.when i retrive the supplier list from Database(oracle) and want to display the details i am putting the object in session and getting it in contactdetails.jsp and showing it and i can't remove the value from the session as i may require the session value to edit another supplier.Untill this all works fine but when i use the contactdetails.jsp to adda new supplier and come to it the jsp it shows the last used session values and displays it on the screen which on the server dosen't show that it is executing the code where this session object is got from the session.
i am attaching the code of the contactdetails.jsp please suggest some solution to this as i have tried out many things for this.
<html>
<%@ page import = "users.SupplierList" %>
<%@ page import = "users.DAO" %>
<%@ page import = "users.Supplier" %>
<%@ page import = "java.util.*;"%>
<%@ page import = "users.Address"%>
<%@ page import = "users.ContactPerson"%>
<%@ page import = "users.AddressList"%>

<head>
<title>Add Supplier</title>
</head>
<%!
//Supplier supp;
String add,add1,city,pin,country,phone1,area_cd,fax,phone2,name1,desig1,cnt_no1,dept1,ext1,em_add1;
String name2,name3,desig2,dept2,ext2,em_add2,desig3,cnt_no2,cnt_no3,dept3,ext3,em_add3;
String srt_name,supp_name,pro_cat,supp_cat,inet_site,em_addr;
String zone_code,ind_code,emp_code,accmgt_code;
String saveflag,nextflag,editcontactflag,addcontactflag;
//ContactPerson conPer;
//Address address;
int index,size,suppsize,counter,sizecon,max;
String[] name,dept,desig,cnt_no,ext,em_add;
//ArrayList conPerList;
//String[] conarray;
%>
<%
response.setHeader("Pragma","no-cache");
//response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires",0);
%>
<body bgcolor="#CCCCFF" text="">
<form name="myform" method="post" action="">
<script language="javascript"><!--
function cleardata()
{
document.myform.reset();
}
function prevdata()
{
document.myform.action="SaveDetails.jsp?nextflag=\"N\"&prevflag=\"P\"";
document.myform.submit()
}
function nextdata()
{
if(document.myform.ADD.value=="")
{
alert("Please enter Address");
document.myform.ADD.focus();
return ;
}
if(document.myform.CITY.value=="")
{
alert("Please enter City");
document.myform.CITY.focus();
return ;
}
if(document.myform.PIN.value=="")
{
alert("Please enter Pin");
document.myform.PIN.focus();
return ;
}
if(document.myform.COUNTRY.value=="")
{
alert("Please enter Country");
document.myform.COUNTRY.focus();
return ;
}
document.myform.action="SaveDetails.jsp?nextflag=\"N\"";
document.myform.submit()
}
function savedata()
{
if(document.myform.ADD.value=="")
{
alert("Please enter Address");
document.myform.ADD.focus();
return ;
}
if(document.myform.CITY.value=="")
{
alert("Please enter City");
document.myform.CITY.focus();
return ;
}
if(document.myform.PIN.value=="")
{
alert("Please enter Pin");
document.myform.PIN.focus();
return ;
}
if(document.myform.COUNTRY.value=="")
{
alert("Please enter Country");
document.myform.COUNTRY.focus();
return ;
}
document.myform.action="SaveDetails.jsp?saveflag=\"S\"";
document.myform.submit()
}
function editcontact()
{
if(document.myform.ADD.value=="")
{
alert("Please enter Address");
document.myform.ADD.focus();
return ;
}
if(document.myform.CITY.value=="")
{
alert("Please enter City");
document.myform.CITY.focus();
return ;
}
if(document.myform.PIN.value=="")
{
alert("Please enter Pin");
document.myform.PIN.focus();
return ;
}
if(document.myform.COUNTRY.value=="")
{
alert("Please enter Country");
document.myform.COUNTRY.focus();
return ;
}
document.myform.action="SaveDetails.jsp?editcontactflag=\"C\"";
document.myform.submit()
}
function addcontact()
{
alert("calling addcontact");
document.myform.action="Addcontact.jsp?addcontactflag=\"A\"";
//window.open("http://gajanan:7001/jsp/Addcontact.jsp?addcontactflag=\"A\"&ADD=<%=add%>&ADD1=<%=add1%>&CITY=<%=city%>&PIN=<%=pin%>&COUNTRY=<%=country%> ;&AREA_CD=<%=area_cd%>&PHONE1=<%=phone1%>&PHONE2=<%=phone2%>&FAX=<%=fax%>&NAME1<%=name1%>&DESIG1=<%=desig1%>&CNT_NO1=<%=cnt_no1%>&DEPT1=&l t;%=dept1%>&EXT1=<%=ext1%>&EM_ADD1=<%=em_add1%>");
document.myform.submit();
//window.close();
}
function editcontactdetails()
{
alert("calling editcontact");
window.open("http://gajanan:7001/jsp/Addcontact.jsp?editcontactflag=\"EF\" ");
window.close();
}
function numeric(thisobj)
{
//version = checkver()
temp = thisobj.value
if (temp.length != 0 && isNaN(temp))
{ alert("This Field should be numeric");
//if (!version)
thisobj.select() }
}
function Alpha(thisobj)
{
//version = checkver()
temp = thisobj.value
if (temp.length != 0 && !(isNaN(temp)))
{ alert("This Field should be Alphabetic");
//if (!version)
thisobj.select() }
}
function CheckMail(thisobj)
{
//Val = thisobj.name;
// alert(Val);
var mail=thisobj.value
// alert(mail)
//var mail=document.myform.EM_ADD1.value
var goodEmail = mail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if(goodEmail)
{
}
else
{
alert("EMail Address is not Valid");
//document.myform.EM_ADD1.focus();
thisobj.focus();
return;
}
}//end of CheckMail
//-->
</script>

<%
//these are the changes made by Poonam.............
/*DAO dao = new DAO();
Vector addConVec = dao.getAddressContactList("S001");
ArrayList addList = (ArrayList) v.get(0);
Vector conVect = (Vector) v.get(1);
for( int i = 0 ; i < addList.size() ; i++)
{
System.out.println( String.valueOf( addList.get(i) ) );
ContactPersonList conList = (ContactPersonList)conVect.get(i);
for ( int j = 0 ; j < conList.size() ; j++ )
{
System.out.println( String.valueOf( conList.get(j) ) );
}
}
*/
%>
<%
if(request.getParameter("counter") != null)
counter=Integer.parseInt(request.getParameter("counter"));
System.out.println("Counter is "+counter);
if(request.getParameter("count") != null)
max=Integer.parseInt(request.getParameter("count"));
System.out.println("Max is "+max);
//this is saveflag, only name is saveconflag..
if(request.getParameter("saveflag") != null)
saveflag=request.getParameter("saveflag");
System.out.println("saveflag is "+saveflag);
if(request.getParameter("nextflag") != null)
nextflag=request.getParameter("nextflag");
System.out.println("nextflag is "+nextflag);
if(request.getParameter("INDEX") != null)
index=Integer.parseInt(request.getParameter("INDEX").trim());
System.out.println("Index is "+index);
if(request.getParameter("editcontactflag") != null)
editcontactflag= request.getParameter("editcontactflag");
System.out.println("Flag to edit contact details is "+editcontactflag);
if(request.getParameter("addcontactflag") != null)
addcontactflag= request.getParameter("addcontactflag");
System.out.println("Flag to add contact details is "+addcontactflag);

//this block will execute only if saveflag comes null..
if(!(saveflag!=null))
{
if (!(counter==0))
{
if(request.getParameter("NAME1") != null)
name1= request.getParameter("NAME1");
if(request.getParameter("DEPT1") != null)
dept1= request.getParameter("DEPT1");
if(request.getParameter("DESIG1") != null)
desig1= request.getParameter("DESIG1");
if(request.getParameter("CNT_NO1") != null)
cnt_no1= request.getParameter("CNT_NO1");
if(request.getParameter("EXT1") != null)
ext1= request.getParameter("EXT1");
if(request.getParameter("EM_ADD1") != null)
em_add1= request.getParameter("EM_ADD1");
System.out.println("Contact Name is "+name1);
System.out.println("EMail id is "+em_add1);

/*this value is got for adding contact person while editing
contact details and value comes from addcontact jsp..*/
//conPer =(ContactPerson)session.getValue("contactperson");
//System.out.println("Contact list is "+conPer);
ContactPerson conPer = new ContactPerson(name1,dept1,desig1,cnt_no1,ext1,em_add1);
System.out.println("After conPer" +conPer);
//this value is reqd for adding in address value..
Address address = (Address)session.getValue("address");
address.addContactPerson(conPer);
System.out.println("After address");
//this is trial
//session.removeValue("address");
size = address.contactPersonListsize();
System.out.println("size of contact persons is"+size);
System.out.println("Contact person list is "+conPer);
name = new String[size];
dept = new String[size];
desig = new String[size];
cnt_no = new String[size];
ext = new String[size];
em_add = new String[size];
System.out.println("Designation is "+desig);
System.out.println("Size of desig is "+desig.length);
for(int i = 0; i<size; i++)
{
conPer = address.getContactPersonAt(i);
name[i]=conPer.getName();
System.out.println("In for loop for size1"+name[i]);
dept[i]=conPer.getDepartment();
System.out.println("In for loop for size2"+dept[i]);
desig[i]=conPer.getDesignation();
System.out.println("In for loop for size3"+desig[i]);
cnt_no[i]=conPer.getPhone();
System.out.println("In for loop for size4"+cnt_no[i]);
ext[i]=conPer.getPhoneExt();
em_add[i]=conPer.getEmail();
}//end of for loop for size..
//this is a trial..
session.putValue("address",address);
counter = 0;
}//end of if for counter...
if (addcontactflag!=null)
{
if(request.getParameter("NAME1") != null)
name1= request.getParameter("NAME1");
if(request.getParameter("DEPT1") != null)
dept1= request.getParameter("DEPT1");
if(request.getParameter("DESIG1") != null)
desig1= request.getParameter("DESIG1");
if(request.getParameter("CNT_NO1") != null)
cnt_no1= request.getParameter("CNT_NO1");
if(request.getParameter("EXT1") != null)
ext1= request.getParameter("EXT1");
if(request.getParameter("EM_ADD1") != null)
em_add1= request.getParameter("EM_ADD1");
System.out.println("Contact Name1 is "+name1);
System.out.println("EMail id1 is "+em_add1);
if(request.getParameter("ADD") != null)
add=request.getParameter("ADD");
System.out.println("Address1 is "+add);
if(request.getParameter("ADD1") != null)
add1=request.getParameter("ADD1");
if(request.getParameter("CITY") != null)
city=request.getParameter("CITY");
if(request.getParameter("COUNTRY") != null)
country=request.getParameter("COUNTRY");
if(request.getParameter("PIN") != null)
pin=request.getParameter("PIN");

if(request.getParameter("PHONE1") != null)
phone1=request.getParameter("PHONE1");
if(request.getParameter("PHONE2") != null)
phone2=request.getParameter("PHONE2");
if(request.getParameter("AREA_CD") != null)
area_cd=request.getParameter("AREA_CD");
if(request.getParameter("FAX") != null)
fax=request.getParameter("FAX");
ContactPerson conPer = new ContactPerson(name1,dept1,desig1,cnt_no1,ext1,em_add1);
System.out.println("After conPer" +conPer);
//address = new Address();
//conPer = (ContactPerson)session.getValue("contact");
Address address = (Address)session.getValue("addr");
address.addContactPerson(conPer);
System.out.println("After conPer Added" +conPer);
size = address.contactPersonListsize();
System.out.println("size of contact persons is"+size);
name = new String[size];
dept = new String[size];
desig = new String[size];
cnt_no = new String[size];
ext = new String[size];
em_add = new String[size];
System.out.println("Designation is "+desig);
System.out.println("Size of desig is "+desig.length);
for(int i = 0; i<size; i++)
{
conPer = address.getContactPersonAt(i);
System.out.println("After conPerson");
name[i]=conPer.getName();
System.out.println("In for loop for size1"+name[i]);
dept[i]=conPer.getDepartment();
System.out.println("In for loop for size2"+dept[i]);
desig[i]=conPer.getDesignation();
System.out.println("In for loop for size3"+desig[i]);
cnt_no[i]=conPer.getPhone();
System.out.println("In for loop for size4"+cnt_no[i]);
ext[i]=conPer.getPhoneExt();
em_add[i]=conPer.getEmail();
}//end of for loop..
//this value will be put only if there is any value in address wanted in session to add new address
if(size!=0)
{
session.putValue("addr",address);
}
addcontactflag=null;
}//end of if block for addcontactflag..
if (editcontactflag!=null)
{
/*this value is got to get supplier values to display for editing wanted in session..*/
Supplier supp =(Supplier) session.getValue("supp");
suppsize = supp.addressListSize();
System.out.println("Size of supplier list is"+suppsize);
System.out.println("Supplier list is "+supp);
Address address = new Address();
if(!(suppsize == 0))
{
System.out.println("In suppsize ");
if (nextflag!=null)
{
address = (Address)session.getValue("addfornext");
System.out.println("Address list1 is "+address);
}
else
{
//this address is got for a specific supplier wanted in session not to remove..
address = (Address)session.getValue("address");
System.out.println("Address list2 is "+address);
}
add = address.getAddress1();
add1= address.getAddress2();
city= address.getCity();
pin= address.getPin();
country=address.getCountry();
phone1=address.getPh1();
area_cd=address.getPhAreaCode();
fax=address.getFax();
phone2=address.getPh2();
}

size = address.contactPersonListsize();
System.out.println("size of contact persons is"+size);

if(!(size == 0))
{
System.out.println("In size ");
name = new String[size];
dept = new String[size];
desig = new String[size];
cnt_no = new String[size];
ext = new String[size];
em_add = new String[size];
System.out.println("Designation is "+desig);
System.out.println("Size of desig is "+desig.length);
for(int i = 0; i<size; i++)
{
ContactPerson conPer = address.getContactPersonAt(i);
name[i]=conPer.getName();
System.out.println("In for loop for size1"+name[i]);
dept[i]=conPer.getDepartment();
System.out.println("In for loop for size2"+dept[i]);
desig[i]=conPer.getDesignation();
System.out.println("In for loop for size3"+desig[i]);
cnt_no[i]=conPer.getPhone();
System.out.println("In for loop for size4"+cnt_no[i]);
ext[i]=conPer.getPhoneExt();
em_add[i]=conPer.getEmail();
}//enf of for loop for size...
}//end of if loop for size..
System.out.println("After size ");
/*add = address.getAddress1();
add1= address.getAddress2();
city= address.getCity();
pin= address.getPin();
country=address.getCountry();
phone1=address.getPh1();
area_cd=address.getPhAreaCode();
fax=address.getFax();
phone2=address.getPh2();
name1=conPer.getName();
dept1=conPer.getDepartment();
desig1=conPer.getDesignation();
cnt_no1=conPer.getPhone();
ext1=conPer.getPhoneExt();
em_add1=conPer.getEmail();
System.out.println("Country is"+country);
System.out.println("Pin code is" +pin);
System.out.println("Address of contact person is "+add);
*/
if(request.getParameter("SRT_NAME") != null)
srt_name= request.getParameter("SRT_NAME");
if(request.getParameter("SUPP_NAME") != null)
supp_name= request.getParameter("SUPP_NAME");
if(request.getParameter("PRO_CAT") != null)
pro_cat= request.getParameter("PRO_CAT");
if(request.getParameter("SUPP_CAT") != null)
supp_cat= request.getParameter("SUPP_CAT");
if(request.getParameter("EM_ADD") != null)
em_addr= request.getParameter("EM_ADD");
if(request.getParameter("INET_SITE") != null)
inet_site= request.getParameter("INET_SITE");
System.out.println("Short name is "+srt_name);
System.out.println("URL id is "+inet_site);
}//end of if for editcontactflag...
}//end of if block for save flag..
%>
<p><center><font face="Book Antiqua" size="5" color=""><em><u><strong>Address/Contact Persons Details</strong></u></em></font></center></p>
<table border=1 width="80%" align="center" bgcolor="">
<tr>
<td align="center" colspan="">
<tr>
<td colspan="1" width="130"><font color="#ff0000">Address</font>
<td colspan="1" width="186">
<input type="text" maxlength=50 name="ADD" value="<%=add%>" size="25">
</td>
<td colspan="1" width="20"> </td>
<td colspan="1" width="20">
<input type="text" maxlength=50 name="ADD1" value="<%=add1%>" size="20">
</td>
<td colspan="1" width="15"> </td>
<td colspan="1" width=""> </td>
</tr>
<tr>
<td colspan="1" height="" bgcolor=""><font color="#ff0000">City</font></td>
<td><input type="text" maxlength=15 name="CITY" value="<%=city%>" size="25" onBlur="Alpha(this);"></td>
<td colspan="1" height="40" bgcolor=""><font color="#ff0000">Pin</font></td>
<td><input type="text" maxlength=15 name="PIN" value="<%=pin%>" size="20" onBlur="numeric(this);"></td>
<td colspan="1" height="" bgcolor=""><font color="#ff0000">Country</font></td>
<td><input type="text" maxlength=15 name="COUNTRY" value="<%=country%>" size="20" onBlur="Alpha(this);"></td>
</tr>
<tr>
<td colspan="1" width="15"> </td>
<td colspan="1" width="15" align="center">Area Code</td>
<td colspan="1" width="20" align="center">Phone 1</td>
<td colspan="1" width="20" align="center">Phone 2</td>
<td colspan="1" width="20" align="center">Fax</td>
</tr>
<tr>
<td colspan="1" height="" bgcolor=""><font color="">Phone</font></td>
<td><input type="text" maxlength=6 name="AREA_CD" value="<%=area_cd%>" size="25" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=8 name="PHONE1" value="<%=phone1%>" size="10" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=8 name="PHONE2" value="<%=phone2%>" size="10" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=8 name="FAX" value="<%=fax%>" size="10" onBlur="numeric(this);"></td>

</tr>
</table>
<p><center><font face="Book Antiqua" size="3" color=""><em><u><strong>Contact Persons:</strong></u></em></font></center></p>
<table border=1 width="80%" align="center" bgcolor="">
<tr>
<td colspan="1" width="20" align="center">Name</td>
<td colspan="1" width="20" align="center">Department</td>
<td colspan="1" width="20" align="center">Designation</td>
<td colspan="1" width="20" align="center">Phone</td>
<td colspan="1" width="20" align="center">Ext</td>
<td colspan="1" width="20" align="center">E Mail Address</td>
</tr>
<%
if(!(size == 0))
{
System.out.println("In if block"+size);
for(int i = 0;i<size ;i++)
{
System.out.println("In for block"+size);
%>
<tr>
<td><input type="text" maxlength=20 name="NAME<%=i%>" value="<%=name[i]%>" size="20" onBlur="Alpha(this);"></td>
<td><input type="text" maxlength=20 name="DEPT<%=i%>" value="<%=dept[i]%>" size="10"></td>
<td><input type="text" maxlength=20 name="DESIG<%=i%>" value="<%=desig[i]%>" size="15" onBlur="Alpha(this);"></td>
<td><input type="text" maxlength=20 name="CNT_NO<%=i%>" value="<%=cnt_no[i]%>" size="10" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=20 name="EXT<%=i%>" value="<%=ext[i]%>" size="7" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=20 name="EM_ADD<%=i%>" value="<%=em_add[i]%>" size="20" onChange="CheckMail(this);"></td>
</tr>
<input type=hidden name=NAME<%=i%> value="<%=name[i]%>">
<input type=hidden name=DEPT<%=i%> value="<%=dept[i]%>">
<input type=hidden name=DESIG<%=i%> value="<%=desig[i]%>">
<input type=hidden name=CNT_NO<%=i%> value="<%=cnt_no[i]%>">
<input type=hidden name=EXT<%=i%> value="<%=ext[i]%>">
<input type=hidden name=EM_ADD<%=i%> value="<%=em_add[i]%>">
<%
}
}else{
System.out.println("In else block of size");
%>
<!-- <tr>
<td><input type="text" maxlength=20 name="NAME1" value="<%=name1%>" size="20" onBlur="Alpha(this);"></td>
<td><input type="text" maxlength=20 name="DEPT1" value="<%=dept1%>" size="10"></td>
<td><input type="text" maxlength=20 name="DESIG1" value="<%=desig1%>" size="15" onBlur="Alpha(this);"></td>
<td><input type="text" maxlength=20 name="CNT_NO1" value="<%=cnt_no1%>" size="10" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=20 name="EXT1" value="<%=ext1%>" size="7" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=20 name="EM_ADD1" value="<%=em_add1%>" size="20" onChange="CheckMail(this);"></td>
</tr>
-->
<%

}//end of else if size is zero...
/*this block is integrated with size block,this sizecon is not reqd..*/
/*if(!(sizecon == 0))
{
System.out.println("In if loop of sizecon");
for(int i = 0;i<sizecon ;i++)
{
// System.out.println("In For loop");
%>
<tr>
<td><input type="text" maxlength=20 name="NAME<%=i%>" value="<%=name[i]%>" size="20" onBlur="Alpha(this);"></td>
<td><input type="text" maxlength=20 name="DEPT<%=i%>" value="<%=dept[i]%>" size="10"></td>
<td><input type="text" maxlength=20 name="DESIG<%=i%>" value="<%=desig[i]%>" size="15" onBlur="Alpha(this);"></td>
<td><input type="text" maxlength=20 name="CNT_NO<%=i%>" value="<%=cnt_no[i]%>" size="10" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=20 name="EXT<%=i%>" value="<%=ext[i]%>" size="7" onBlur="numeric(this);"></td>
<td><input type="text" maxlength=20 name="EM_ADD<%=i%>" value="<%=em_add[i]%>" size="20" onChange="CheckMail(this);"></td>
</tr>
<%
}//end of for loop for sizecon
}//end of if loop for sizecon
*/
%>
</table>
<br>
<input type=hidden name=INDEX value="<%=index%>">
<input type=hidden name=SRT_NAME value="<%=srt_name%>">
<input type=hidden name=SUPP_NAME value="<%=supp_name%>">
<input type=hidden name=PRO_CAT value="<%=pro_cat%>">
<input type=hidden name=SUPP_CAT value="<%=supp_cat%>">
<input type=hidden name=EM_ADD value="<%=em_addr%>">
<input type=hidden name=INET_SITE value="<%=inet_site%>">
<input type=hidden name=ADD value="<%=add%>">
<input type=hidden name=ADD1 value="<%=add1%>">
<input type=hidden name=CITY value="<%=city%>">
<input type=hidden name=PIN value="<%=pin%>">
<input type=hidden name=COUNTRY value="<%=country%>">
<input type=hidden name=AREA_CD value="<%=area_cd%>">
<input type=hidden name=PHONE1 value="<%=phone1%>">
<input type=hidden name=PHONE2 value="<%=phone2%>">
<input type=hidden name=FAX value="<%=fax%>">
<input type=hidden name=NAME1 value="<%=name1%>">
<input type=hidden name=DESIG1 value="<%=desig1%>">
<input type=hidden name=DEPT1 value="<%=dept1%>">
<input type=hidden name=CNT_NO1 value="<%=cnt_no1%>">
<input type=hidden name=EXT1 value="<%=ext1%>">
<input type=hidden name=EM_ADD1 value="<%=em_add1%>">
<input type=hidden name=count value="<%=max%>">
<table align="center">
<tr>
<%
if (editcontactflag!=null)
{
%>
<td><input type="Button" name="Next" value="Next" onClick="javascript:nextdata()"> </td>
<td><input type="Button" name="Previous" value="Previous" onClick="javascript revdata()"> </td>
<td><input type="Button" name="Save" value="Save" onClick="javascript:editcontact()"> </td>
<td><input type="Button" name="Cancel" value="Cancel" onClick="javascript:cleardata()"> </td>
<td><input type="Button" name="Add Contact" value="Add Contact" onClick="javascript:editcontactdetails()"></td>
<%
}else{
%>

<td><input type="Button" name="Save" value="Save" onClick="javascript:savedata()"> </td>
<td><input type="Button" name="Cancel" value="Cancel" onClick="javascript:cleardata()"> </td>
<td><input type="Button" name="Add Contact" value="Add Contact" onClick="javascript:addcontact()"></td>
<%
}
editcontactflag=null;
%>
</tr>
</table>
</body>
</html>
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Wow, was it really necessary to post all that code? Anyway, your problem is in the exclamation mark:
<%!
Instance variables, loads of 'em. Get rid of them. You can probably convert most of them to local variables (drop the !). Those things that you need to remember between requests go into the user's session.
You could do worse than read a good JSP book to fill the gaps in your knowledge. Phil Hanna's Professional JSP comes warmly recommended.
- Peter
 
 
subject: Cache Problem in Jsp...