when you have updated the table .
you.d better response.sendRedirectZ("successs.jsp");
how do you think?(~|||||~)

----- Original Message -----
From: "Vijeth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 3:49 PM
Subject: Last Row in table gets repeated on Refresh....Help


> Hi :
> I am adding rows to a table, but after I add a row refresh the page, the
last row gets repeated, Please help..
> I am using the folowing code.....
>
> <%@ page language="java" session="true" import="java.util.*" %>
> <HTML>
> <HEAD>
> <META NAME="GENERATOR" Content="Visual Page 1.0 for Windows">
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
>
> <title>Test</title>
>
> <script language="JavaScript">
> var str_name;
> var str_id;
> var str_mail;
> var str_newValue;
>
> <%
> boolean bolIsSessionNew = false;
> ArrayList al=(ArrayList) session.getAttribute("setval");
> System.out.println("****1 :"+al);
> if((al == null ) || (al.size()==0) ){
>  al=new ArrayList();
>  bolIsSessionNew= true;
>  }
>
> String strWhatToDo = request.getParameter("hidWhatToDo") != null ?
request.getParameter("hidWhatToDo"):"";
> String strArrayInfo = request.getParameter("hidArrayInfo") != null ?
request.getParameter("hidArrayInfo"):"";
> if ( strWhatToDo.equalsIgnoreCase("addvalue") ) {
>   al.add(strArrayInfo);
>
> }
> System.out.println("strArrayInfo :"+strArrayInfo);
>
> %>
>
> function add() {
> str_name =document.f1.name.value;
> str_id  =document.f1.id.value;
> str_mail =document.f1.email.value;
> str_newValue = str_name+"~~~"+str_id+"~~~"+str_mail;
>
>  document.forms[0].hidArrayInfo.value=str_newValue;
>  document.forms[0].hidWhatToDo.value="addValue";
>  document.forms[0].action="testAdd.jsp";
>  document.forms[0].submit();
>
> }
>
> </script>
> </HEAD>
>
> <body BACKGROUND="../images/spacer.gif" BGCOLOR="#66CCCC" >
> <FORM NAME="f1" method="post" action="">
>
> <P ALIGN="LEFT"><FONT SIZE="4" COLOR="#000077"><B><U>Enter
Data:</U></B></FONT>
> <TABLE BORDER="0" WIDTH="100%">
>  <TR>
> <TD><font face=Arial size=4>Name:</font></TD>
> <TD><font face=Arial size=4><INPUT TYPE="TEXT" SIZE=10 NAME="name"></Font>
> </TD>
> <TD ><font face=Arial size=4>EmpId:</font></TD>
> <TD ><font face=Arial size=4><INPUT TYPE="TEXT" SIZE=5 NAME="id"></font>
> </TD>
> <TD ><font face=Arial size=4>Email:</font></TD>
> <TD ><font face=Arial size=4><INPUT TYPE="TEXT" SIZE=10
NAME="email"></font>
> </TD>
> <TD ><font face=Arial size=4><INPUT TYPE="Button" width="20" Value="Add"
onClick="add()"></font></TD>
> </TR>
> </TABLE>
> <HR>
>
> <TABLE BORDER="1" cellpadding="1" cellspacing="1" WIDTH="100%">
>
> <%
>  for(int i=0;i<al.size();i++) {
> %>
> <tr>
> <td align="center"><%=al.get(i)%></td>
> </tr>
> <%
> }
> session.setAttribute("setval",al);
> %>
> </table>
>
> <input type="hidden" name="hidArrayInfo" value="" />
> <input type="hidden" name="hidWhatToDo" value="Nothing" />
>
> </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
>

===========================================================================
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

Reply via email to