Solved

how to pass objects from a servlet to a jsp without a framework ?

Posted on 2004-08-12
9
217 Views
Last Modified: 2010-04-01
hi all,

i'm trying to seperate my business logic layer (servlets) from my presentation layer (jsp) .
for example, if my servlet has a recordset of student records, how do i pass it to a jsp to be displayed ?
i know it can be done in frameworks like spring, but is it achieveable without a framework ?
0
Comment
Question by:shenlong_wc
  • 5
  • 4
9 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11781500
Stick it in the session:

  session.setAttribute( "myobject", list ) ;
0
 

Author Comment

by:shenlong_wc
ID: 11781528
that's gonna be a gross misuse of sessions ?
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11781544
Why?

You can also stick it in the request object (if the servlet and the jsp are called via the same request)

  request.setAttribute( "myobject", list ) ;
0
 

Author Comment

by:shenlong_wc
ID: 11781593
sorry ... din occur to me i can clear the session variable after i receive it.
i was imagining there would be memory problems.

btw, what did you ment when you say "call via the same request ?"
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 35

Expert Comment

by:TimYates
ID: 11781604
if your jsp calls a servlet, passing it the request object you can put stuff in the request object
0
 

Author Comment

by:shenlong_wc
ID: 11781656
oh, could you show a few lines of codes to demo it ? or point me to an website that teaches it?
0
 
LVL 35

Accepted Solution

by:
TimYates earned 20 total points
ID: 11781668
0
 

Author Comment

by:shenlong_wc
ID: 11781691
thanks !
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11781714
Glad to help :-)

Good luck!

Tim
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet concurrency 13 93
error when compiling my project in eclipse luna 30 349
dateFashion java challenge 9 132
listing all functions in JavaScript 19 178
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now