• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

requestDispatcher

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
result set should be transfered from servlet to jsp
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by lathainses muthu:
result set should be transfered from servlet to jsp



can you explain in detail?

note:

---------------------------
please give meaningful subjectline
-------------------------------
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If at all you are looking for making the resultset available to the called JSP, I would put the resultset into a session and call the jsp. You can also put the resultset into a request, call the jsp and can achieve the same results. By putting in session, I make sure that those values are available across all requests with in the session.
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi lathainses muthu
See How to ask questions on Javaranch

It will help you.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey don't store a ResultSet into a session. A ResultSet is connected to the database on which the query was run. If you store a ResultSet then strange things might happen. The connection to the database might remain open. But I think it will not allow you to add a ResultSet object to a session (I once tried to return a ResultSet from a RMI server and it didn't work).

Instead use javax.sql.rowset.CachedRowSet i.e. store it in the session as it follows disconnected architecture.
For details refer to the JDK Documentation.
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSPs are just for presentation not logic. You should process the ResultSet in the Servlet and transform the results into a presentation view which you place into the session.
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ankit,

Can you explain how you were not able to add a Resultset to session and what was the problem you encountered.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As peviously pointed out, resultsets in the session is a bad bad idea. Copy the data to a suitable collection and store that.
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Schandha Ravi:
Hi Ankit,

Can you explain how you were not able to add a Resultset to session and what was the problem you encountered.



Well I didn't store the ResultSet in a session. I actually returned a ResultSet from a RMI method. But it gave me some error at run time(I don't remember what). I think it's because ResultSet is not Serializable. Now I think that if that's true then CachedRowSet will not work either as it is also not Serializable. Bear Bibeault is right, you should use some Collection or Map implementation...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ankit G@rg", please check your private messages for an important administrative matter.
 
reply
    Bookmark Topic Watch Topic
  • New Topic