473,418 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

REFRESH Problem IN JSP

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
4 3557
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
sukatoa
539 512MB
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
ajos
283 100+
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
16,027 Expert Mod 8TB
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

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

Similar topics

3
by: Scott | last post by:
I have a clickable graph that resides on page 1. If user clicks a data point on the graph, the page runs again yeilding a 2nd graph that shows a more detailed graph. Problem is, I have a...
4
by: Yogi_Bear_79 | last post by:
Self Taught here so please bear with me. I have the labelRestrictSites as private on the MainForm.cs. I then access the labelRestrictSites.Text thru the public string LabelRestrictSites from...
1
by: Marco Maroni | last post by:
How to force image refresh on client browser ? Is ti possible to force the refresh of the same image (tha was changed server-side) to the client, without user press Contrl+F5 in IE ? - Marco
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
0
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in...
7
by: Brian | last post by:
hello, I am looking for a way to auto refresh a web page that I created, but also let the user choose to stop the auto refresh. I can not figure out how to stop the auto refresh. Any help would...
12
by: martin1 | last post by:
All, is there window form refresh property? I try to set up window form refresh per minute. Thanks
10
by: Bill Nguyen | last post by:
I would like to be able to get an active browser window to refresh the URL (reload) every 5 minutes. Is it possible in VB.NET? Thanks Bill
0
by: chetu | last post by:
I have two pivot tables, but when my macro refreshes the pivot tables it refreshes all, but I want it to pick say for example; Say range "B8" of pivot table 1 is 60, I want the range "x2" of pivot...
4
by: Simon | last post by:
Dear reader, If I change the content of a field in an event procedure and in the same procedure I do a refresh, the refresh has no effect. The code in the event is as follows:
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.