This week's book giveaway is in the Flex forum.
We're giving away four copies of Flex 4 in Action and have Tariq Ahmed, Dan Orlando, John C. Bland II & Joel Hooks on-line!
See this thread for details.
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of Flex 4 in Action this week in the Flex forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Engineering » HTML and JavaScript
 
RSS feed
 
New topic
Author

JavaScript Objects to set array of request parameters

Sara Smith
Greenhorn

Joined: Oct 20, 2006
Messages: 28

I am going to display below results in the JSP page. I have a Wizard kind of a flow, where user can go back & forth by clicking on the different Tabs provided (Edit, Search, Review, Finish). I can�t use sessions in my application.

First column: a check box
Second column: Client Number
Third column:Cleint Name
Fourth column: Portfolio
Fifth column: Drop Down
Six column: Radio Button

I need to save all the selections made into the JavaScript Object and pass through it back & forth. I don�t know how to use it.
Can any of you please provide any information on how I set all the request values to the Java Script Objects? Any code samples or any help is greatly appreciated.
Bear Bibeault
Author and opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36547

Originally posted by Sara Smith:
I can�t use sessions in my application.


Let me guess. You've got some idiot CTO or project leader that told you not to use sessions regardless of when they are the right tool for the job?

Any JavaScript objects will be lost going from page to page. If you "can't" use the session, you'll need to pass them as request parameters to each page.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Christophe Verré
Bartender

Joined: Nov 24, 2005
Messages: 11110

If you can't use sessions, you could keep all the needed stuff in the request, by using hidden parameters. Get the needed values from the submitted form, then put them in hidden tags.

I'm also curious about why you can't use sessions, as the above method works, but maintainability is close from 0%

[SCWCD Wall of Fame] [SCBCD Wall of Fame]
All roads lead to JavaRanch
Sara Smith
Greenhorn

Joined: Oct 20, 2006
Messages: 28

Reason we don�t want to use session because our application will be running on multiple servers & we don�t have session persistent mechanism. Users request can be served from any of these servers & how can we handle session persistent data? In this scenario can I still make use of sessions?

My application will be are part of an inner frame, outer frame being the parent frame. Outer frame will not be refreshed; inner frame is where my application will live. Can�t I use a JavaScript Objects in the outer frame to save my request data and pass it on the request values?

In the given scenario which is the better approach using session or Java Script? I can use the Hidden parameters, but they will be lot of data manipulations back & forth. That will be my last option to go with.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Messages: 13045

As long as the outer frame is not being refreshed you can use it to cache data on the client.

window.parent.VAR_NAME will give you access to variables in the frameset (or parent page if you're using iframes).

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples
 
jQuery in Action
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Engineering » HTML and JavaScript
 
RSS feed
 
New topic
MyEclipse Enterprise Workbench