Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem displaying data in table  RSS feed

 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am getting some values from database into arraylist in a jsp page and I am binding those arraylist's into session object and forwarding control to another jsp page. My problem is that I am using



to forward the session object, but when I store the session object again in an araylist in my MainPage it is not having any values in it.

When I am using jsp:forward action tag instead of sendRedirect I am getting those values in the MainPage table.

What could be the error? Please clarify.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this
but when I store the session object again in an araylist in my MainPage it is not having any values in it.

a typo or are you really trying to store your session object in an array list?

If it's not a typo, why are you trying to do this?
 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben

I didn't get the word, "Is this the typo?", anyways I will try to be a bit clear in explaining my problem.

Actually I am using some controller jsp's in my project where I am actually storing values from the database in arraylist's, which are then forwarded to other related Main Pages by binding to session object.

When I am using response.sendRedirect() method I am unable to get the values from one of my controller page from where I am sending those values binding to a session object. But, when I am including that controller jsp page at runtime in my Main page I am getting those values properly.

I think this explanation will be a bit clear in explaining you my problem.
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


Whenever you use sendRedirect() server creates a fresh request and whatever data you have stored in request object is lost.
On the contarary when you use forwaord...server forwards same request to another resource in that web-application...and you will not loose the value that you have stored in request object.

Thanks
Dhananjay
 
Sree Mami
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dhananjay

Thanks for your clarification. I am using action tag forward only now so that I can persist information in request object.


Thanks once again...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!