Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JSP Session Refresh Problem

Posted on 2004-08-11
10
Medium Priority
?
3,791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 75 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 300 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: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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

715 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