Solved

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

Posted on 2004-08-12
9
218 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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
 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

815 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

8 Experts available now in Live!

Get 1:1 Help Now