aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript Objects to set array of request parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript Objects to set array of request parameters" Watch "JavaScript Objects to set array of request parameters" New topic
Author

JavaScript Objects to set array of request parameters

Sara Smith
Greenhorn

Joined: Oct 20, 2006
Posts: 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 ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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%


[My Blog]
All roads lead to JavaRanch
Sara Smith
Greenhorn

Joined: Oct 20, 2006
Posts: 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
Posts: 13410

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 jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript Objects to set array of request parameters
 
Similar Threads
Rich Internet Applications
role of cookie in session
Display Check Boxes & Dropdowns in Struts with search results
Session Management
How can I catch session timeout event?