Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Array ussing session  RSS feed

 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I wish to pass array of string via session from java class to jsp.. Please help

Thank you in advance
 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why you want to pass through session? what about request?
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

seetharaman venkatasamy wrote:why you want to pass through session? what about request?



Thanks for the quick reply. Sorry I am new to java .
I dont want to use scriptlets to retrive data from DB in jsp. So I tought of sending the entire records by retriving it in java class and then pass it using session and array.

What is request?

Thank you in advance
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to check out some basic JEE documentation.

The request is a scope that exists for the duration of the request.

To put an attribute into the request just call setAttribute(name, value) on the request.
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

David Newton wrote:You may want to check out some basic JEE documentation.

The request is a scope that exists for the duration of the request.

To put an attribute into the request just call setAttribute(name, value) on the request.



Yes i am fine with that. How to retrive data, say if there are 10 rows in the table. How do i display all of them. if I retrive them in the java class and pass them on the jsp for displaying.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use java class to get a connection to db,get the 10 rows thru a select query and set it in request,pass the ctrl to a jsp and then retrieve the values from the request and display them
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

thru sai krishna wrote:use java class to get a connection to db,get the 10 rows thru a select query and set it in request,pass the ctrl to a jsp and then retrieve the values from the request and display them




Thank you for the quick responce.
And do mean resultset.

Thank you in advance.
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!