473,473 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Session is getting invadate on page refresh in Mozilla

5 New Member
I am stuck in quite a tricky problem, That is - My page session which contains username is getting invalidating on page refresh in Firefox Mozilla. Same is working fine in IE-9

I am pasting the code of both header and index.jsp file.


Header.jsp

Expand|Select|Wrap|Line Numbers
  1. <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
  2. <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
  3. <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
  4. <%@ page language="java"
  5.     import="java.util.*,com.project.web.*,com.project.vo.*"
  6.     pageEncoding="ISO-8859-1"%>
  7.  
  8.  
  9. <html>
  10. <head>
  11.  
  12. <script type="text/javascript" src="./js/jquery-1.4.4.js"></script>
  13.     <link href="./css/headerstyle.css" rel="stylesheet" type="text/css"
  14.     media="all" />
  15.     <link href="./css/style_horizontal_naviagation.css" rel="stylesheet" type="text/css" />
  16.     <link rel="stylesheet"
  17.     href="./css/commonheader.css" type="text/css" />
  18.     <script type="text/javascript">
  19.             $(document).ready(function(){
  20.  
  21.  
  22.  
  23. var $div1 = $('ul.the_menu');
  24. var height1 = $div1.height();
  25. $div1.hide().css({ height : 0 });
  26.  
  27. $("img#menu_class").click(function () {
  28.   if ( $div1.is(':visible') ) {
  29.       $("ul.the_menu").slideUp(800);
  30.                             setTimeout(
  31.                             function() {
  32.                                 $('ul.the_menu').stop(true, true).hide(); 
  33.                             }, 700);
  34.   } else {
  35.     $div1.css({ height: 20});
  36.     $div1.show().animate({ height : 300 }, { duration: 800 }, {"easing": "easein"});
  37.   }
  38.  
  39.   return false;
  40. });
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. var $div = $('#contactForm');
  48. var height = $div.height();
  49. $div.hide().css({ height : 0 });
  50.  
  51. $("#contactLink").click(function () {
  52.   if ( $div.is(':visible') ) {
  53.       $("#contactForm").slideUp(800);
  54.                         setTimeout(function() {
  55.                             $('#contactForm').stop(true, true).hide(); 
  56.                         }, 700);
  57.   } else {
  58.     $div.css({ height: 20});
  59.     $div.show().animate({ height : 300 }, { duration: 800 }, {"easing": "easein"});
  60.   }
  61.  
  62.   return false;
  63. });
  64.  
  65.  
  66.  
  67.  
  68.             //demo 1
  69.  
  70.  
  71.             //demo 2
  72.             //$('select#valueA, select#valueB').selectToUISlider();
  73.  
  74.  
  75.             //demo 3
  76.  
  77.  
  78.         });
  79.         //purely for theme-switching demo... ignore this unless you're using a theme switcher
  80.         //quick function for tooltip color match
  81.  
  82.  
  83.     </script>
  84.  
  85.  
  86. </head>
  87. <body>
  88.  
  89.  
  90. <%!String username;%>
  91.  <% username = (String) session.getAttribute("username");
  92.  
  93. session.setAttribute("username", username);
  94.  %>
  95. <div id="header" >
  96.  
  97. <div id="horizontalnav1">
  98.         <a href="http://bytes.com/submit/udaan/"><img src="http://bytes.com/images/home.png" width="87" height="49" alt="Home" /></a>
  99.         </div>
  100.     <div id="horizontalnav2">    
  101.     <div id="container_menu">
  102. <div id="button">
  103. <img src="http://bytes.com/images/categories.png" width="130" height="48" alt="Categories" id="menu_class" /><ul class="the_menu">
  104. <li><a href="#">A Website #1</a></li><!--
  105. --><li><a href="#">A Website #2</a></li><!--
  106. --><li><a href="#">A Link #1</a></li><!--
  107. --><li><a href="#">A Link #2</a></li><!--
  108. --><li><a href="#">A Website #3</a></li><!--
  109. --><li><a href="#">A Website #4</a></li><!--
  110. --><li><a href="#">A Link #3</a></li><!--
  111. --><li><a href="#">A Link #4</a></li>
  112. </ul>
  113. </div>
  114.  
  115. </div>
  116.  
  117.  
  118. </div>
  119. <div id="horizontalnav3">
  120.                     <a href="./postAdRedirect.jsp?username=<%=username%>"><img src="http://bytes.com/images/postad.png" width="102" height="49" alt="Post Ad" /></a>
  121.  
  122. </div>
  123. <div id="horizontalnav4">
  124.                     <a href="./myDetailsRedirect.jsp"><img src="http://bytes.com/images/myvfinds.png" width="124" height="49" alt="MyVfinds" /></a>
  125.  
  126. </div>
  127.  
  128. <% 
  129.         if ((username == null) || (username == "")) {
  130. %>
  131. <div class="box">
  132. <div id="contactFormContainer">
  133. <div id="contactForm">
  134. <form id="loginform" action="login.do" method="post">
  135. <fieldset><label for="username">Username *</label> <input
  136.     name="username" type="text" /> <label for="password">Password
  137. *</label> <input name="password" type="password" /> <input id="submit"
  138.     type="submit" name="submit" onclick="submitform()" /> <span
  139.     id="messageSent">Your message has been sent successfully!</span></fieldset>
  140. </form>
  141. </div>
  142. <div id="contactLink"></div>
  143. </div>
  144. </div>
  145.  
  146. <%
  147.     } else {
  148. %>
  149.  
  150. <div id="logout">
  151. <a href="logout.do"><img border="0"
  152.     width="100%" height="100%" alt="" src="http://bytes.com/images/logout.gif"></a>
  153.     <form id="#">
  154.  
  155. </form></div>
  156. <%
  157.     }
  158. %>
  159.  
  160.  
  161.  
  162. </div>
  163. </body>
  164. </html>
  165.  
Index.jsp

Expand|Select|Wrap|Line Numbers
  1. <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
  2. <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
  3. <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
  4.  <!DOCTYPE taglib
  5.     PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
  6.     "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
  7.  
  8. <%@ page language="java"
  9.     import="java.util.*,com.project.web.*,com.project.vo.*"
  10.     pageEncoding="ISO-8859-1"%>
  11.  
  12. <%
  13.     String path = request.getContextPath();
  14.     String basePath = request.getScheme() + "://"
  15.             + request.getServerName() + ":" + request.getServerPort()
  16.             + path + "/";
  17. %>
  18. <%
  19. String cookieName = "city";
  20. Cookie cookies [] = request.getCookies ();
  21. Cookie myCookie = null;
  22. if (cookies != null)
  23. {
  24. for (int i = 0; i < cookies.length; i++) 
  25. {
  26. if (cookies [i].getName().equals (cookieName))
  27. {
  28. myCookie = cookies[i];
  29. break;
  30. }
  31. }
  32. }
  33. %>
  34. <html>
  35. <head>
  36. <style type="text/css">@import url("thickbox.css") screen;</style>
  37. <title>VFinds...</title>
  38.  
  39. <meta name="Description" content="How to Build a Basic CSS Layout" />
  40. <meta name="Keywords" content="css layout" />
  41. <link rel="stylesheet"
  42.     href="./css/homepage.css" type="text/css" />
  43.  
  44.  
  45. <link href="./css/showhide.css" rel="stylesheet" type="text/css"
  46.     media="all" />
  47.     <script type="text/javascript" src="./js/cookie.js"></script>
  48.  
  49.  
  50.  
  51.                     <link href="homepageslider.css" rel="stylesheet" type="text/css" media="all" />
  52.         <script src="jquery-1.2.6.js" type="text/javascript" charset="utf-8"></script>
  53.     <script src="jquery-ui-full-1.5.2.min.js" type="text/javascript" charset="utf-8"></script>
  54.  
  55. <script type="text/JavaScript" src="./js/curvycorners.src.js"></script>
  56.  
  57. <link rel="stylesheet" href="general.css" type="text/css" media="screen" />
  58.     <script src="popup.js" type="text/javascript"></script>
  59.  
  60. <link rel="stylesheet" type="text/css" href="./css/style.css" />
  61.  
  62. <script type= "text/javascript" src="subCategoryClassfiedAjaxHomepage.js"></script>
  63. <script type="text/javascript" src="./js/combo.js"></script>
  64.  
  65. <script type="text/javascript">
  66. function submitform()
  67. {
  68.   document.loginform.submit();
  69.   closeForm();
  70. }
  71. function submitformSearch()
  72. {
  73.   document.search.submit();
  74.   closeForm();
  75. }
  76.  
  77.  
  78. </script>
  79.  
  80. <script src="thickbox.js" type="text/javascript"></script>
  81.     <script type="text/javascript" charset="utf-8">
  82.  
  83.         window.onload = function () {
  84. checkCookieForCity();
  85.  
  86.  };
  87.     </script>
  88.  
  89.  
  90.  
  91.  
  92. <script type="text/javascript">
  93. <!--
  94.     function toggle_visibility(id) {
  95.        var e = document.getElementById(id);
  96.        if(e.style.display == 'block')
  97.           e.style.display = 'none';
  98.        else
  99.           e.style.display = 'block';
  100.     }
  101. //-->
  102. </script>
  103.  
  104. <style type="text/css">
  105. fieldset {
  106.     border: 0;
  107.     margin: 5px;
  108.     height: 8em;
  109.     width: 190px;
  110. }
  111.  
  112. label {
  113.     font-weight: normal;
  114.     margin-right: .5em;
  115.     font-size: 12px;
  116.     color: #5A5A5A;
  117. }
  118.  
  119. select {
  120.     margin-right: 1em;
  121. }
  122.  
  123. .ui-slider {
  124.     clear: both;
  125.     top: 1em;
  126. }
  127. </style>
  128.  
  129.  
  130. <!-- jQuery UI theme switcher -->
  131.  
  132. <script type="text/javascript">
  133. function submitform()
  134. {
  135.   document.loginform.submit();
  136.   closeForm();
  137. }
  138. </script>
  139.  
  140.  
  141.  
  142.  
  143. </head>
  144. <body>
  145. <%!String[] destList;%>
  146.  
  147. <div id="wrapper">
  148. <%@include file="./header.jsp"%>
  149.  
  150. <%! public static String cityvalue = null;
  151. public static String city = null;%> 
  152.  
  153. <%
  154. if (myCookie == null) {
  155. %>
  156. No Cookie found with the name <%=cookieName%>
  157. <%
  158. } else {
  159. %> 
  160.  
  161. <%
  162. session.setAttribute("city",myCookie.getValue());
  163.  
  164.  city = (String)session.getAttribute("city");
  165.  
  166.     int citylength = city.length();
  167.     String remainingletterexceptfirst = city.substring(1, citylength);
  168.     String cityfirstletter = city.substring(0,1);
  169.     String newcityfirstletter = cityfirstletter.toUpperCase();
  170.      cityvalue = newcityfirstletter + remainingletterexceptfirst;
  171.     %>
  172.     City from session = <%=cityvalue%>
  173. Welcome: <%=cityvalue%>.
  174. <%
  175. }
  176. %>
  177.  
  178. <div id = "username" style="position: absolute; left: 20px; top: 71px; width: 118px; z-index: 0;">
  179.  
  180. <%
  181.  
  182. if(username == null){
  183.         out.println("You are not logged in");
  184.  
  185. %><b></b><%
  186. }else{
  187.     out.println("Welcome : " + username );
  188.     }%>
  189. </div>
  190.  
  191.  
  192. <div id="modifysearch">
  193.     <div class="myBox">
  194.  
  195.     <form id = "search" action="search.do">
  196.     <div id = "text" style="position:relative;left:15px;top:15px;width:153px; height:40px;" >
  197.  
  198.     <font color="#463E3F"><B><I>Interested in </I></B></font>
  199.  
  200.     </div>
  201. <div id = "category" style="position:absolute;left:110px;top:15px;width:153px;">
  202. <select name="category" id = "category_id"  onchange="showSubcategoryClassfiedHomepage(this.value)"  >
  203. <option >--Select category--</option>
  204. <option value = "realestate">Real Estate</option>
  205. <option value= "appliances" >Appliances</option>
  206. <option value =  "households">House Holds</option>
  207. <option value = "vehicle">Vehicles</option>
  208. <option value = "computers">computers and Mobiles</option>
  209.   </select>
  210.   </div>
  211.  
  212.    <div id="subcategory" style="position:absolute;left:290px;top:15px;width:153px;">
  213. <select name="subcategory"   id="subcategory" class="combo">
  214. <option value="">-- Select Sub Category--</option>
  215. </select>
  216. </div>
  217.  
  218.    <div id="city" style="position:absolute;left:470px;top:15px;width:153px;">
  219. <select name="city" >
  220. <option selected value=<%=cityvalue%>><%=cityvalue%></option>
  221. <option value = "bangalore">Bangalore</option>
  222.   <option value= "delhi" >Delhi</option>
  223.   <option value =  "mumbai">Mumbai</option>
  224. </select>
  225. </div>
  226.    <div id="submit" style="position:absolute;left:590px;top:4px;">
  227.  <input id="submit" type="Submit" name="submit" onclick="submitformSearch()" />
  228. </div>
  229. </form>
  230.  
  231.  
  232.  
  233.     </div>
  234.  
  235.  
  236.  
  237.  
  238.  
  239. </div>
  240.  
  241. <div id="footer">footer</div>
  242.  
  243. </div>
  244.  
  245. <div id="popupContact">
  246.         <a id="popupContactClose">x</a>
  247.         <h1>Choose City</h1>
  248.         <p id="contactArea">
  249.         Bangalore : <input type="radio" name="formradio1" value = "bangalore" onClick="javascript: setCookie('city','bangalore',365);" >
  250.             <br/><br/>
  251.         Delhi : <input type="radio" name="formradio1" value = "delhi"  onClick="javascript: setCookie('city','delhi',365);" >
  252.             <br/><br/>
  253.             <a target="_parent" href= "../udaan/index.jsp" > Click here to continue...<img src=" "></a> 
  254.  
  255.         </p>
  256.     </div>
  257.     <div id="backgroundPopup"></div>
  258. </body>
  259. </html>
  260.  
  261.  

I am not sure why its happening only in Mozilla.Thanks in advance.
May 16 '11 #1
1 1828
samarinder
5 New Member
As suggested by support person i am copying the code which may has a problem

Below is the code snipet from header.jsp, Which i am including in index.jsp

Expand|Select|Wrap|Line Numbers
  1. <%!String username;%>
  2.  <% username = (String) session.getAttribute("username");
  3.  
  4. session.setAttribute("username", username);
  5.  %>
  6.  
On page refresh session is getting invalidating in Firefox mozilla. Working fine in IE
May 17 '11 #2

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

Similar topics

1
by: Ken Williams | last post by:
I made a web app, some form data is posted to a report.html that makes changes to a database. if the user does this and views the report, and then refreshes the web page the same information and...
1
by: ppatel | last post by:
Problem I have a problem with web image button control click event. The click event does not get trigger until it has not been clicked once or page refresh occures(which is fine). When click...
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...
1
by: Leon | last post by:
what my title will not load the user session values on first load, but will load on page refresh? code.. *html file.. <HTML> <HEAD> <title> <asp:literal id="Title"...
10
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application and I need to find a way to cause a page refresh from within my application. Does anyone know how to force the browser to refresh the current page? ...
2
by: adam | last post by:
Hi ASP Expert, I encounter a page reload situation in ASP. It is I need a way to differentiate whether the current page - "Application_Result.asp" got reloaded itself when user click on the...
1
by: Ibrahim. | last post by:
Hi, I have a login page, the problem I'm facing is like this; 1. Login page with submit button (being default button); 2. When first time the page is submitted then submit code is called. ...
4
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. If an ASP.NET page postsback, for example, after a button is clicked, and then I refresh the page (ie, by pressing F5 key), why does the same event occur when I press F5 as it did when I...
2
by: Astrix | last post by:
Hi, I am working on a problem w.r.t session.timeout I have a code to redirect to this new page after 20 seconds. Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) -...
4
by: sriram | last post by:
Hello Friends, I am new to this group so big HIIIIIIII to all :) fine i have a serious doubt about session handling in PHP. After 20 min (default time) session getting expired, session values...
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
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,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.