File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes A stack to be accessed by various pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "A stack to be accessed by various pages" Watch "A stack to be accessed by various pages" New topic
Author

A stack to be accessed by various pages

CD Phillips
Greenhorn

Joined: Apr 13, 2005
Posts: 6
I am trying to implement a stack that allows HTML pages / Javascripts to push values onto and pop values from this common stack.

Any ideas would be very helpful.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
There is no way of maintaing or sharing data from page to page with JavaScript unless you resort to cookies, query strings, or hidden frames. Cookies and query strings can not hold objects and hidden frames can disrupt navigation....

The thing that JavaScript annoys developers is that objects are created and destroyed as the pages are rendered. Variables are reset and heads bang against walls.

What are you trying to do exactly? Are you just trying to keep from adding functions from page to page? Then you can use external JS files.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

This is exactly what the concept of a session in server-side languages (such as JSP/Servlets) is for.

As Eric pointed out, this would be very difficult and hobbled using only client-side technologies.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
CD Phillips
Greenhorn

Joined: Apr 13, 2005
Posts: 6
Thanks for your speedy reply Eric.

I am building a demo of a voice mail application interface. Each digit selection made by the user on numeric virtual telephone keypad takes him to a new page, the requested new menu, that also presents the user again with the keypad for further selections and so on. (Basically the user navigates using this simulated telephone keypad as he would a voice app using a real phone.)

Every time a new page loads, presenting new menu options, I would like to display, in a frame positioned besides the onscreen keypad on the desktop, menu tracking information to allow the user of the demo to visually see his history of activity.

Since the history object does not allow access to its location properties I am trying to use a stack to store each location (or just some string representation of it) in the stack. By doing so I can use the contents of the stack to create a call flow diagram, where each item in the stack would be a node (green box if you run the script below) representing previous user selections.

ps. By the way, I hope Shona said yes?





[made it formatted - Eric]
[ June 21, 2005: Message edited by: Eric Pascarello ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can use a hidden frame to keep track of the changes. Bascially store the information into a array on that page and you would be able to use it.

I do not have time to look at your code right now to see what to change to get this to work exactly.

Eric
(She said yes - getting married Oct. 1st)
CD Phillips
Greenhorn

Joined: Apr 13, 2005
Posts: 6
Many thanks, and all the very best for your wedding plans.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A stack to be accessed by various pages