By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

REFRESH Problem IN JSP

P: 7
Hi

I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button.
All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button.

The Category name is being fetched from the oracle db along with the corresponding Category order.

In the corresponding input field (text box) the user enters a new category order which gets stored in the db on using the submit button.
The new category order (number) has to be less or equal to the count of the categories . On Submitting the New category order a sql procedure is called which updates the order and then the new order is displayed in the category Order column in the same jsp page.

The procedure looks like this:

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE proc_ordUpdate
  2.  
  3. (oldOrder IN number,newOrder IN number, catname IN varchar2 )
  4. IS
  5. begin
  6. if oldOrder>0 and newOrder>0 and oldOrder!=newOrder then
  7. if oldOrder<newOrder then
  8. update cms_video_info set CATORDER=-1 where CATORDER = oldOrder and CATNAME=catname;
  9. update cms_video_info set CATORDER=CATORDER-1 where CATNAME=catname and CATORDER between oldOrder+1 and newOrder;
  10. update cms_video_info set CATORDER=newOrder where CATORDER=-1 and CATNAME=catname;
  11. else
  12. update cms_video_info set CATORDER=-1 where CATORDER=oldOrder and CATNAME=catname;
  13. update cms_video_info set CATORDER=CATORDER+1 where CATNAME=catname and CATORDER between newOrder and oldOrder-1;
  14. update cms_video_info set CATORDER=newOrder where CATORDER=-1 and CATNAME=catname;
  15. end if;
  16.  
My jsp page looks like this:

Expand|Select|Wrap|Line Numbers
  1. <%@ page language="java" %>
  2. <%@ page import="java.sql.*" %>
  3. <%@ page import="java.util.*" %>
  4. <%@ page import="java.io.*" %>
  5. <%@ page import="java.security.*" %>
  6. <%@ page import="java.net.URL" %>
  7. <%@ page import="java.net.HttpURLConnection" %>
  8. <%@ page import="com.btsl.*" %>
  9. <%
  10. response.setHeader("Cache-Control","no-cache");
  11. response.setHeader("Pragma","no-cache");
  12. response.setDateHeader ("Expires", 60);
  13. %>
  14.  
  15. <script type="text/javascript">
  16. function FormAction(cost_rad)
  17. {
  18. document.frm1.submit();
  19. }
  20. </script>
  21.  
  22. <script language="JavaScript">
  23. function update(old_catorder,new_catorder,catname,seq,count )
  24. {
  25. if (new_catorder == old_catorder){
  26. alert("New order and Old order should not be same");
  27. return false;
  28. }
  29. else if (new_catorder > count) {
  30. alert("New Order should be between 1 and "+count);
  31. return false;
  32. }
  33. else{
  34. var field_pos="new_catorder"+seq;
  35. //alert(field_pos)
  36. //alert("new_catorder:"+document.getElementById(field_pos).value);
  37.  
  38. document.frm1.old_catorder.value=old_catorder;
  39. document.frm1.new_catorder.value=document.getEleme ntById(field_pos).value;
  40. document.frm1.catname.value=catname;
  41.  
  42. alert(document.frm1.catname.name);
  43. alert(document.frm1.catname.value);
  44. alert(document.frm1.old_catorder.value);
  45. alert(document.frm1.new_catorder.value);
  46.  
  47. document.frm1.submit();
  48. return true;
  49. }
  50. }
  51. </script>
  52.  
  53.  
  54.  
  55. <%
  56. int old_catorder=0;
  57. int new_catorder=0;
  58. String catname="";
  59. int count=0;
  60. int curr_catorder=0;
  61. String cost_rad="";
  62. String query ="";
  63.  
  64. Connection db_conn = null;
  65. Statement db_st = null;
  66. ResultSet rs =null;
  67. CallableStatement proc=null;
  68.  
  69. Vector<String> catnameVec = new Vector<String>(1,1);
  70. Vector<Integer> old_CatOrderVec = new Vector<Integer>(1,1);
  71.  
  72. if((String)request.getParameter("cost_rad")!=null)
  73. {
  74. cost_rad=request.getParameter("cost_rad");
  75. }
  76.  
  77. System.out.println("Selected cost_rad is :: "+cost_rad);
  78.  
  79. try {
  80. db_conn = OracleConnectionUtil.getConnection();
  81. db_st=db_conn.createStatement();
  82.  
  83. if (cost_rad.equals("Free"))
  84. {
  85. System.out.println("applying free query");
  86. query = "select distinct catname,catorder from cms_video_info where cost ='0' order by catorder asc";
  87. }
  88. else
  89. {
  90. System.out.println("applying paid query");
  91. query = "select distinct catname,catorder from cms_video_info where cost !='0' order by catorder asc";
  92. }
  93.  
  94. try
  95. {
  96. rs=db_st.executeQuery(query);
  97. }
  98. catch(Exception e)
  99. {
  100. System.out.println("ERROR!!! Exception while getting catname");
  101. }
  102.  
  103. /* if not null print the result of query */
  104.  
  105. if(rs !=null)
  106. {
  107. System.out.println("value of rs:"+rs);
  108. try
  109. {
  110. while(rs.next())
  111. {
  112. try
  113. {
  114. catnameVec.add((rs.getString(1)).trim());
  115. old_catorder=rs.getInt(2);
  116. old_CatOrderVec.add(old_catorder);
  117. }
  118. catch(SQLException subE)
  119. {
  120. System.out.println("ERROR!!! sql exception while fetching data" +subE);
  121. }
  122. }
  123. } catch(Exception er)
  124. {
  125. System.out.println("ERROR!!! problem in result set" +er);
  126. }
  127. }
  128. try{
  129. if((String)request.getParameter("catname")!= null)
  130. {
  131. System.out.println("catname is" );
  132. catname=request.getParameter("catname");
  133. System.out.println("catname is" +catname);
  134. }
  135.  
  136. if(Integer.parseInt((String)request.getParameter("new_catorder").trim())!=0)
  137. {
  138. System.out.println("new_catorder is" );
  139. new_catorder=Integer.parseInt((String)request.getP arameter("new_catorder").trim());
  140. System.out.println("new catorder is " +new_catorder);
  141. }
  142. }catch(Exception e)
  143. {
  144. System.out.println("Exception catname old_catorder"+old_catorder);
  145. }
  146.  
  147. if(Integer.parseInt((String)request.getParameter("old_catorder").trim())!=0)
  148. {
  149. old_catorder=Integer.parseInt((String)request.getP arameter("old_catorder").trim());
  150. System.out.println("old catorder is " +old_catorder);
  151.  
  152. try
  153. {
  154.  
  155. System.out.println("Proc calling");
  156. String strQuery = "{call proc_ordUpdate(?,?,?)}";
  157. proc = db_conn.prepareCall(strQuery);
  158. //proc.registerOutParameter(3,Types.VARCHAR);
  159. System.out.println("Execution update values:old_catorder"+old_catorder+"new_catorder"+new_catorder+"catname"+catname);
  160. proc.setInt(1,old_catorder);
  161. System.out.println("old_catorder="+old_catorder);
  162. proc.setInt(2,new_catorder);
  163. System.out.println("new_catorder="+new_catorder);
  164. proc.setString(3,catname);
  165. System.out.println("catname="+catname);
  166.  
  167. proc.registerOutParameter(3,Types.VARCHAR);
  168. System.out.println("executing Proc");
  169. try{
  170. System.out.println("inside :executing Proc");
  171. proc.execute();
  172. }catch(Exception e)
  173. {
  174. System.out.println("executing ProcEXECP");
  175. }
  176. System.out.println("executing completed");
  177. System.out.println("old catorder updated successfully");
  178. } catch(Exception ex)
  179. {
  180. System.out.println("ERROR!!! failed to update catorder" +ex);
  181. }
  182. }
  183.  
  184. }
  185. catch(Exception e)
  186. {
  187. e.printStackTrace();
  188. System.out.println("ERROR After Procedure!!! unable to connect to oracle DB");
  189. }
  190. finally
  191. {
  192. if (proc != null)
  193. {
  194. proc.close();
  195. proc = null;
  196. }
  197.  
  198. if(db_conn!=null)
  199. {
  200. db_conn.commit();
  201. rs.close();
  202. db_st.close();
  203. db_conn.close();
  204. }
  205. }
  206. %>
  207.  
  208. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  209. <html xmlns="http://www.w3.org/1999/xhtml">
  210. <head>
  211. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. <script type="text/javascript">
  220. function reloadPage()
  221. { window.location.reload(); }
  222. </script>
  223.  
  224. </head>
  225.  
  226. <form name=frm1 action="vem_catOrder.jsp" method="Post">
  227.  
  228. <body>
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236. <table width="95%"; align="center"; border="2"; cellpadding="0">
  237. <tr height="30">
  238. <th width="38%"; align="center">Category</th>
  239. <th width="32%"; align="center">Current Order</th>
  240. <th width="25%"; align="center">Set Order</th>
  241.  
  242. </tr>
  243. </table>
  244.  
  245. <div style="overflow:auto; width:100%; height:110px" align="center">
  246. <table width="95%"; align="center"; border="1"; cellpadding="0"; cellspacing="2">
  247.  
  248. <%
  249. try {
  250. for (int i =0; i < catnameVec.size(); i++)
  251. {
  252. %>
  253. <tr>
  254. <td width="38%"; align="center";>
  255. <input type=hidden name='<%="catname"+i%>' id=catname"+i+" value='<%=catnameVec.elementAt(i)%>'/><%=catnameVec.elementAt(i)%>
  256. </td>
  257. <td width="32%"; align="center";>
  258. <input type=hidden name=old_catorder"+i+" id=old_catorder"+i+" value='<%=old_CatOrderVec.elementAt(i)%>'/><%=old_CatOrderVec.elementAt(i)%>
  259. </td>
  260. <td width="15%"; align="center";>
  261. <INPUT type="text" name='<%="new_catorder"+i%>' id='<%="new_catorder"+i%>' style="WIDTH: 80px" maxLength=15 value=""/>
  262. </td>
  263.  
  264. <td width="10%" align="center">
  265. <input type="button" name=button"+i+" id=button"+i+" onClick='return update("<%=old_CatOrderVec.elementAt(i)%>","<%=new_catorder%>","<%=catnameVec.elementAt(i)%>",<%=i%>,<%=catnameVec.size()%>)' value="Submit"/></td>
  266. </tr>
  267. <%
  268. }
  269. }
  270. catch(Exception e) {
  271. System.out.println("got Exception"+e);
  272. }
  273. %>
  274.  
  275. </table>
  276. </div>
  277.  
  278. <INPUT type=hidden name=old_catorder value="">
  279. <INPUT type=hidden name=new_catorder value="">
  280. <INPUT type=hidden name=catname value="">
  281.  
  282. <br />
  283.  
  284. </form>
  285.  
  286. </body>
  287. </html>
  288.  
  289.  
  290. else
  291.  
  292. dbms_output.put_line('please check the new order and old order');
  293.  
  294. end if;
  295.  
  296. end;
################################################## ################

My problem is that after i submit the page the previous given value is displayed and on calling refresh i get a random values. I guess the function update gets called everytime i refresh the page.
someone suggested to use a request dispatcher.
I have no clues as to how to go about it.

Please HELP!!!
Aug 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: 7
Hi

I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button.
All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button.

The Category name is being fetched from the oracle db along with the corresponding Category order.

In the corresponding input field (text box) the user enters a new category order which gets stored in the db on using the submit button.
The new category order (number) has to be less or equal to the count of the categories . On Submitting the New category order a sql procedure is called which updates the order and then the new order is displayed in the category Order column in the same jsp page.

The procedure looks like this:

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE proc_ordUpdate
  2.  
  3. (oldOrder IN number,newOrder IN number, catname IN varchar2 )
  4. IS
  5. begin
  6. if oldOrder>0 and newOrder>0 and oldOrder!=newOrder then
  7. if oldOrder<newOrder then
  8. update cms_video_info set CATORDER=-1 where CATORDER = oldOrder and CATNAME=catname;
  9. update cms_video_info set CATORDER=CATORDER-1 where CATNAME=catname and CATORDER between oldOrder+1 and newOrder;
  10. update cms_video_info set CATORDER=newOrder where CATORDER=-1 and CATNAME=catname;
  11. else
  12. update cms_video_info set CATORDER=-1 where CATORDER=oldOrder and CATNAME=catname;
  13. update cms_video_info set CATORDER=CATORDER+1 where CATNAME=catname and CATORDER between newOrder and oldOrder-1;
  14. update cms_video_info set CATORDER=newOrder where CATORDER=-1 and CATNAME=catname;
  15. end if;
  16.  
My jsp page looks like this:

Expand|Select|Wrap|Line Numbers
  1. <%@ page language="java" %>
  2. <%@ page import="java.sql.*" %>
  3. <%@ page import="java.util.*" %>
  4. <%@ page import="java.io.*" %>
  5. <%@ page import="java.security.*" %>
  6. <%@ page import="java.net.URL" %>
  7. <%@ page import="java.net.HttpURLConnection" %>
  8. <%@ page import="com.btsl.*" %>
  9. <%
  10. response.setHeader("Cache-Control","no-cache");
  11. response.setHeader("Pragma","no-cache");
  12. response.setDateHeader ("Expires", 60);
  13. %>
  14.  
  15. <script type="text/javascript">
  16. function FormAction(cost_rad)
  17. {
  18. document.frm1.submit();
  19. }
  20. </script>
  21.  
  22. <script language="JavaScript">
  23. function update(old_catorder,new_catorder,catname,seq,count )
  24. {
  25. if (new_catorder == old_catorder){
  26. alert("New order and Old order should not be same");
  27. return false;
  28. }
  29. else if (new_catorder > count) {
  30. alert("New Order should be between 1 and "+count);
  31. return false;
  32. }
  33. else{
  34. var field_pos="new_catorder"+seq;
  35. //alert(field_pos)
  36. //alert("new_catorder:"+document.getElementById(field_pos).value);
  37.  
  38. document.frm1.old_catorder.value=old_catorder;
  39. document.frm1.new_catorder.value=document.getEleme ntById(field_pos).value;
  40. document.frm1.catname.value=catname;
  41.  
  42. alert(document.frm1.catname.name);
  43. alert(document.frm1.catname.value);
  44. alert(document.frm1.old_catorder.value);
  45. alert(document.frm1.new_catorder.value);
  46.  
  47. document.frm1.submit();
  48. return true;
  49. }
  50. }
  51. </script>
  52.  
  53.  
  54.  
  55. <%
  56. int old_catorder=0;
  57. int new_catorder=0;
  58. String catname="";
  59. int count=0;
  60. int curr_catorder=0;
  61. String cost_rad="";
  62. String query ="";
  63.  
  64. Connection db_conn = null;
  65. Statement db_st = null;
  66. ResultSet rs =null;
  67. CallableStatement proc=null;
  68.  
  69. Vector<String> catnameVec = new Vector<String>(1,1);
  70. Vector<Integer> old_CatOrderVec = new Vector<Integer>(1,1);
  71.  
  72. if((String)request.getParameter("cost_rad")!=null)
  73. {
  74. cost_rad=request.getParameter("cost_rad");
  75. }
  76.  
  77. System.out.println("Selected cost_rad is :: "+cost_rad);
  78.  
  79. try {
  80. db_conn = OracleConnectionUtil.getConnection();
  81. db_st=db_conn.createStatement();
  82.  
  83. if (cost_rad.equals("Free"))
  84. {
  85. System.out.println("applying free query");
  86. query = "select distinct catname,catorder from cms_video_info where cost ='0' order by catorder asc";
  87. }
  88. else
  89. {
  90. System.out.println("applying paid query");
  91. query = "select distinct catname,catorder from cms_video_info where cost !='0' order by catorder asc";
  92. }
  93.  
  94. try
  95. {
  96. rs=db_st.executeQuery(query);
  97. }
  98. catch(Exception e)
  99. {
  100. System.out.println("ERROR!!! Exception while getting catname");
  101. }
  102.  
  103. /* if not null print the result of query */
  104.  
  105. if(rs !=null)
  106. {
  107. System.out.println("value of rs:"+rs);
  108. try
  109. {
  110. while(rs.next())
  111. {
  112. try
  113. {
  114. catnameVec.add((rs.getString(1)).trim());
  115. old_catorder=rs.getInt(2);
  116. old_CatOrderVec.add(old_catorder);
  117. }
  118. catch(SQLException subE)
  119. {
  120. System.out.println("ERROR!!! sql exception while fetching data" +subE);
  121. }
  122. }
  123. } catch(Exception er)
  124. {
  125. System.out.println("ERROR!!! problem in result set" +er);
  126. }
  127. }
  128. try{
  129. if((String)request.getParameter("catname")!= null)
  130. {
  131. System.out.println("catname is" );
  132. catname=request.getParameter("catname");
  133. System.out.println("catname is" +catname);
  134. }
  135.  
  136. if(Integer.parseInt((String)request.getParameter("new_catorder").trim())!=0)
  137. {
  138. System.out.println("new_catorder is" );
  139. new_catorder=Integer.parseInt((String)request.getP arameter("new_catorder").trim());
  140. System.out.println("new catorder is " +new_catorder);
  141. }
  142. }catch(Exception e)
  143. {
  144. System.out.println("Exception catname old_catorder"+old_catorder);
  145. }
  146.  
  147. if(Integer.parseInt((String)request.getParameter("old_catorder").trim())!=0)
  148. {
  149. old_catorder=Integer.parseInt((String)request.getP arameter("old_catorder").trim());
  150. System.out.println("old catorder is " +old_catorder);
  151.  
  152. try
  153. {
  154.  
  155. System.out.println("Proc calling");
  156. String strQuery = "{call proc_ordUpdate(?,?,?)}";
  157. proc = db_conn.prepareCall(strQuery);
  158. //proc.registerOutParameter(3,Types.VARCHAR);
  159. System.out.println("Execution update values:old_catorder"+old_catorder+"new_catorder"+new_catorder+"catname"+catname);
  160. proc.setInt(1,old_catorder);
  161. System.out.println("old_catorder="+old_catorder);
  162. proc.setInt(2,new_catorder);
  163. System.out.println("new_catorder="+new_catorder);
  164. proc.setString(3,catname);
  165. System.out.println("catname="+catname);
  166.  
  167. proc.registerOutParameter(3,Types.VARCHAR);
  168. System.out.println("executing Proc");
  169. try{
  170. System.out.println("inside :executing Proc");
  171. proc.execute();
  172. }catch(Exception e)
  173. {
  174. System.out.println("executing ProcEXECP");
  175. }
  176. System.out.println("executing completed");
  177. System.out.println("old catorder updated successfully");
  178. } catch(Exception ex)
  179. {
  180. System.out.println("ERROR!!! failed to update catorder" +ex);
  181. }
  182. }
  183.  
  184. }
  185. catch(Exception e)
  186. {
  187. e.printStackTrace();
  188. System.out.println("ERROR After Procedure!!! unable to connect to oracle DB");
  189. }
  190. finally
  191. {
  192. if (proc != null)
  193. {
  194. proc.close();
  195. proc = null;
  196. }
  197.  
  198. if(db_conn!=null)
  199. {
  200. db_conn.commit();
  201. rs.close();
  202. db_st.close();
  203. db_conn.close();
  204. }
  205. }
  206. %>
  207.  
  208. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  209. <html xmlns="http://www.w3.org/1999/xhtml">
  210. <head>
  211. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. <script type="text/javascript">
  220. function reloadPage()
  221. { window.location.reload(); }
  222. </script>
  223.  
  224. </head>
  225.  
  226. <form name=frm1 action="vem_catOrder.jsp" method="Post">
  227.  
  228. <body>
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236. <table width="95%"; align="center"; border="2"; cellpadding="0">
  237. <tr height="30">
  238. <th width="38%"; align="center">Category</th>
  239. <th width="32%"; align="center">Current Order</th>
  240. <th width="25%"; align="center">Set Order</th>
  241.  
  242. </tr>
  243. </table>
  244.  
  245. <div style="overflow:auto; width:100%; height:110px" align="center">
  246. <table width="95%"; align="center"; border="1"; cellpadding="0"; cellspacing="2">
  247.  
  248. <%
  249. try {
  250. for (int i =0; i < catnameVec.size(); i++)
  251. {
  252. %>
  253. <tr>
  254. <td width="38%"; align="center";>
  255. <input type=hidden name='<%="catname"+i%>' id=catname"+i+" value='<%=catnameVec.elementAt(i)%>'/><%=catnameVec.elementAt(i)%>
  256. </td>
  257. <td width="32%"; align="center";>
  258. <input type=hidden name=old_catorder"+i+" id=old_catorder"+i+" value='<%=old_CatOrderVec.elementAt(i)%>'/><%=old_CatOrderVec.elementAt(i)%>
  259. </td>
  260. <td width="15%"; align="center";>
  261. <INPUT type="text" name='<%="new_catorder"+i%>' id='<%="new_catorder"+i%>' style="WIDTH: 80px" maxLength=15 value=""/>
  262. </td>
  263.  
  264. <td width="10%" align="center">
  265. <input type="button" name=button"+i+" id=button"+i+" onClick='return update("<%=old_CatOrderVec.elementAt(i)%>","<%=new_catorder%>","<%=catnameVec.elementAt(i)%>",<%=i%>,<%=catnameVec.size()%>)' value="Submit"/></td>
  266. </tr>
  267. <%
  268. }
  269. }
  270. catch(Exception e) {
  271. System.out.println("got Exception"+e);
  272. }
  273. %>
  274.  
  275. </table>
  276. </div>
  277.  
  278. <INPUT type=hidden name=old_catorder value="">
  279. <INPUT type=hidden name=new_catorder value="">
  280. <INPUT type=hidden name=catname value="">
  281.  
  282. <br />
  283.  
  284. </form>
  285.  
  286. </body>
  287. </html>
  288.  
  289.  
  290. else
  291.  
  292. dbms_output.put_line('please check the new order and old order');
  293.  
  294. end if;
  295.  
  296. end;
  297.  
################################################## ################

My problem is that after i submit the page the previous given value is displayed and on calling refresh i get a random values. I guess the function update gets called everytime i refresh the page.
someone suggested to use a request dispatcher.
I have no clues as to how to go about it.

Please HELP!!!
Aug 27 '08 #2

100+
P: 539
Yup....
If you are trying to handle that transaction in just a page, and when you attempt to click the refresh button(from browser), a null value will be received from all request.getParameter("form member name") method....

That may lead to:
-Unexpected result
-Allocate most of the time in debugging(hard to debug)
-More lines of unnecessary scriptlets
-More experiments to test the code....

Why don't you add another jsp document that handles all values and then process.... starts from database(better to use bean) until input handling.... and redirect back into the main page(needs a bean, yet not prone to error if tested)?

I think you're not using javabean here.....(use to separate transaction from presentation)....

regards,
sukatoa
Aug 27 '08 #3

100+
P: 283
Hi

My problem is that after i submit the page the previous given value is displayed and on calling refresh i get a random values. I guess the function update gets called everytime i refresh the page.
someone suggested to use a request dispatcher.
I have no clues as to how to go about it.

Please HELP!!!
Im not sure what the actual problem here is, not gone through your code completely yet.

My problem is that after i submit the page the previous given value is displayed and on calling refresh i get a random values
But by your above statement i think you have a caching problem here.

Try putting this in right after your <body> tag and see if this helps.
Expand|Select|Wrap|Line Numbers
  1. <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader ("Expires", 0); //prevents caching at the proxy server response.setHeader("Cache-Control","no-store"); //HTTP 1.1 %>
I feel you can do better by putting the scriptlet code from the jsp page to a servlet class which will help you in the long run trying to maintain and debug the code. Its a beast trying to debug this code if you are not sure where the problem is, also the next time when you post your code try posting your code inside the code tags which is the hash(#) button on the tool bar above.

Edit:- Too late it seems ;).
Edit2:- You seem to put the noCache statements, will have to give your code a closer look it seems.

regards,

ajos
Aug 27 '08 #4

acoder
Expert Mod 15k+
P: 16,027
raghuvendra, JavaScript does not equal JSP. There are two very different languages. I've merged your threads after moving one.

Please also remember to use code tags when posting code. See How to Ask a Question. Thanks!
Aug 27 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.