Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2005, 11:58 AM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting Session variables problems

I am trying to set a session variable to pass between pages. It only seems to work if I print the variable to the page before I try to reference the variable. The code setting the variable is:

<%

var varStartDate = new Date();

Session("varStartDate") = varStartDate;

var strStartDate = (Session("varStartDate").getMonth() + 1) + "/" + Session("varStartDate").getDate() + "/" + Session("varStartDate").getFullYear();

Session("strStartDate") = strStartDate;

    %>

<SCRIPT LANGUAGE = JavaScript>
    window.top.main.location='DisplayMonthlySchedule.a sp';
</SCRIPT>

Using this code, when "DisplayMonthlySchedule.asp" runs, I get an error:

Response object error 'ASP 0185 : 8000ffff'
Missing Default Property

/Scheduling/DisplayMonthlySchedule.asp, line 162

A default property was not found for the object.


If I change the original code to (change in red):

<%

var varStartDate = new Date();

Session("varStartDate") = varStartDate;

var strStartDate = (Session("varStartDate").getMonth() + 1) + "/" + Session("varStartDate").getDate() + "/" + Session("varStartDate").getFullYear();

Session("strStartDate") = strStartDate;

    %>
    varStartDate = <%=Session("varStartDate")%><br>
    strStartDate = <%=Session("strStartDate")%><br>

<SCRIPT LANGUAGE = JavaScript>
    window.top.main.location='DisplayMonthlySchedule.a sp';
</SCRIPT>


Things work just fine. The problem is that I don't want these dates showing up on the browser. Anyone know what this error means and how to eliminate it?

It appears that:

Session("strStartDate") = strStartDate; this passes fine
Session("varStartDate") = varStartDate; this generates error above


Thanks for your help!

Rich


__________________
Ego is a faithful friend; He stays with us all the way to the crater.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Session State Timeout AgentSmith ASP.NET 1.0 and 1.1 Basics 1 July 12th, 2007 07:07 AM
session setting asp_4_all ASP.NET 2.0 Basics 1 March 29th, 2007 07:15 AM
setting value of the variables depending on condit sheetm XSLT 0 September 11th, 2006 01:43 AM
Session Variables - help? Annoyamouse BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 11 August 31st, 2004 03:56 PM
Setting a DB value on Session Abandon bigmish Classic ASP Databases 6 July 19th, 2004 10:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.