Solved

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

Posted on 2004-08-12
9
216 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
Comment Utility
Stick it in the session:

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

Author Comment

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

Expert Comment

by:TimYates
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 35

Expert Comment

by:TimYates
Comment Utility
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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:shenlong_wc
Comment Utility
thanks !
0
 
LVL 35

Expert Comment

by:TimYates
Comment Utility
Glad to help :-)

Good luck!

Tim
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

12 Experts available now in Live!

Get 1:1 Help Now