Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-12
9
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

721 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