• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing objects across JSPs when cookies ='false'  RSS feed

 
Kavita Shivani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
In my application, in the context.xml of Tomcat, I have made cookies='false'. I did this because I dont want to rely on cookies chances are there that the client browser cookies might be disabled. But after doing this, I cant use request.get/setAttribute(). most of the times it returns null. And I cant use form parameters everytime and duplicate the data that I need to carry forward in each form. everything remains only till the next page. Could anyone suggest me how this kind of issues are handled in general.
I have a jsp - create Invoice where user enters all the items and price in a form. on submit of this page, I go to Invoice jsp where the invoice is displayed as read only. There is also a button print invoice on the second page, upon clicking on that button, a popup opens with empty table of items. Here I want my invoice items to be present. I am opening this popup using javascript. I am not sure if I can pass the invoice object as parameter to the JS function then pass it as URL parameter while calling window.open().

thanks,
Kavitha.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cookies will have no effect on your ability to set request-scoped variables, or to submit forms. Some other factor must be at play.
 
Kavita Shivani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so when i set my object using request.setAttribute(), is the object available across the pages and just not the next page after I make cookies false?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, it has nothing whatsoever to do with cookies. A scoped variable set on request scope is available for the duration of the request, but not on subsequent request. Cookies are not a part of the equation.

Or are you meaning to be asking about the session?
 
Kavita Shivani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ok, so I might have to shift the focuse to fix this problem. I shall do that.

Thanks a lot, that was very quick and helpful reply from you.

Kavitha.
 
samir singha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kavitha,
if you want your objects should be available in all jsp, you may use request.getSession().setAttribute(). Try this. Hope this will work.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
samir singha wrote:
if you want your objects should be available in all jsp, you may use request.getSession().setAttribute(). Try this. Hope this will work.

Unless URL rewriting is on there's no way to identify the client's session.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!