Link to home
Start Free TrialLog in
Avatar of joshuayoo
joshuayoo

asked on

Question on passing values from Servlet TO JSP

I am currently working on a web project that has employed Model 2, wcich is recommended in the specification.
Servlet receives http request and do some work and return
Jsp pages and blah blah...

Question to seasoned experts is as following.

I use the session as interim "basket" to hold the
process results. In other words, Servlet puts the "result"
as an session property(Attribute), then JSP pages uses it
while rendering the page to be displayed. As a project
gets bigger, I have more tedious tasks to keep all
"resulting objects" in order.
I am wondering what architecture or methods other experts
are using in this situation.

I appreciate all comments and advises.

Have a good one...

JY



ASKER CERTIFIED SOLUTION
Avatar of pellep
pellep
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skinsella
skinsella

instead of using the session, consider using the request.setAttribute() and request.getAttribute().

If the objects created in the servlet are only needed for the resulting JSP, then put them into the request context, and you don't have to worrya bout cleaning them up subsequently.

sean
Avatar of joshuayoo

ASKER

Thanks for comments, pellep.

Actually, that is what I am doing right now. I was
wondering if I am doing it right. Your comments assured
me that I am doing ok. I wish I had more comments on this.
Well, I think it is time to wrap up and close it down.
I will appreciate if you have more comments.

JY



skinsella, sorry that my question was obscure. I was
working on session-bound data passing...I did not
clearly mention it. I thank you for your comment.



I'm glad I could raise your confidence in your design. At the end of the day, you have to be comfortable with your design, or you'll have a hard time implemeting it. Good luck!

/Par