Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript Objects to set array of request parameters

 
Sara Smith
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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%
 
Sara Smith
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic