Solved

JSP Session Refresh Problem

Posted on 2004-08-11
10
3,684 Views
Last Modified: 2008-02-01
Hi,

I have a left and right frame pages. Each frame gets refresh for a certain value get from interval.java
Now Left Frame has the Tree Nodes, when you click on any node, the output is print on right frame.
This is kinda links on nodes: "Detail.jsp?Id=@id"
This detail.jsp takes the Id as parameter and displays in right frame, also I'm saving this Id as sesstion.setAttribute in order to navigate to other jsp pages(right frames only) which required parameter as id. So the problem is as I said after every few sec/min left frame & right frame gets refresh. Once the left frame get refresh, the right page (Detail.jsp or other jsp pages) gives error by saying null values for id.

Is it that when left frame gets refresh, the session get clear on right frame pages too. ?? What is the proper way to solve this. Please hlep out.

Regards
0
Comment
Question by:princehyderabad
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 1

Expert Comment

by:justywong
ID: 11779976
you mean auto refresh using meta tag?
remember to add the ID value in your refresh url.

e.g.
<meta http-equiv="refresh" content="180;URL=Detail.jsp?Id=<%=id%>">
0
 

Author Comment

by:princehyderabad
ID: 11780058
No my friend, read it again.
Left Frame refresh sec/min is get from JSP1
Right Frame refresh sec/min is get from JSP2

Everytime Left gets refresh, the right page which stores session values passed as a getParameter from left frame becoming null. How can I save session ? Even after left frame get refresh the right page should hv the session value but not null
0
 
LVL 1

Expert Comment

by:justywong
ID: 11780084
can you post your code?

you set the session attribute whenever ur left frame refresh?
if your refresh url didn't have the parameter, you jsp will get a null from it and set to session.
so u've to check before u set your attribute.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:princehyderabad
ID: 11780125
Left Frame has Menus. ONce you click on the any menu. The page is opened in the right frame. This is my Right Frame code.
Values  are passed using getParameter Id, IpAddress, Name as you can see the below code.

<%@ page session="true" %>
<% String id = request.getParameter("Id");
   String ipa = request.getParameter("IpAddress");
   String sn = request.getParameter("Name");

      if(id==null){
                          id = (String)session.getAttribute("id");
      }
            if(ipa==null){
                         ipa = "default";
      }
     
      if (id!=null)
      {
      session.setAttribute("id",id);
      session.setAttribute("ipa",ipa);
      session.setAttribute("sn",sn);
      }
 %>
<html>
<head>
<jsp:include page="/resource/GetResourcePollingInterval">
     <jsp:param name="mm.resourceId" value="<%=id%>" />
</jsp:include>
<meta http-equiv="refresh" content="<%=request.getAttribute(INTERVAL)%>;url=http://localhost:8080/ResourceMonitor.jsp">

==========================================
Left Frame Refresh code:

<jsp:include page="/resource/GetResourcePollingInterval">
     <jsp:param name="mm.resourceId" value="<%=id%>" />
</jsp:include>
<meta http-equiv="refresh" content="<%=request.getAttribute(INTERVAL)%>;url=http://localhost:8080/ResourceMonitor.jsp">

================================

So once the left frame gets refresh, the right page also refresh at same interval and gives the "null" value for Id and refreshs to error page saying String null...
0
 
LVL 1

Assisted Solution

by:justywong
justywong earned 25 total points
ID: 11780222
your code seems ok........... I tested it too and work fine.

1 more question, just want to make sure..... did u turn off your cookies in browser?
Sorry that can't help you.
0
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 100 total points
ID: 11856586
The following page should be called some thing like this

http://YourServer/YourPath/Yourpage.jsp?id=YourID

Otherwise your request is always null

or if you are using forward then
<%
String id = request.geAttribute("Id");
%>




<%@ page session="true" %>
<% String id = request.getParameter("Id");
   String ipa = request.getParameter("IpAddress");
   String sn = request.getParameter("Name");

      if(id==null){
                          id = (String)session.getAttribute("id");
      }
            if(ipa==null){
                         ipa = "default";
      }
     
      if (id!=null)
      {
      session.setAttribute("id",id);
0
 

Expert Comment

by:spiderman19
ID: 12005938
0
 

Expert Comment

by:Ndivhuwo
ID: 12062789
what is the difference between jsp and javascript
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12062890
>>what is the difference between jsp and javascript

You should ask with ur own question

Anyways
JSP(Java Sever Pages) is Java based server side program

JavaScript can be either serverside or client side script language. Most of the people use Javascript to validate the html fields or to submit the html fields to Server Pages

0
 

Expert Comment

by:parmanz
ID: 12346235
when i invoke a jsp page..initially the page passes null value to the servlet page which is called using <jsp:forward>..how can i rectify the problem
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using if condition without JSTL 2 109
How to find missing packages when using Netbeans IDE 8.1 ? 19 54
oracle fusion vs MQ 2 114
struts hibernate integration example 28 135
This tutorial shows how to create a greeting card by combining two image layers and a text layer on a PC using a free image editing app.
Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question