aspose file tools*
The moose likes JSP and the fly likes How to send object from servlet to jsp without using Scoped variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to send object from servlet to jsp without using Scoped variables" Watch "How to send object from servlet to jsp without using Scoped variables" New topic
Author

How to send object from servlet to jsp without using Scoped variables

satyaprasad veeramsetti
Greenhorn

Joined: Dec 21, 2012
Posts: 28
Hi guys, how can we send any object ,from servlet to jsp but below conditions apply
a)don't use scoped variables and
b)Jstl with EL-exepresions.
please let me know is there any another way of sending object to jsp from servlet...

Thanks in advance
Satyaprasad
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61227
    
  66

Is this a puzzle? An interview question?

Because otherwise it makes no sense to not used scoped variables for their intended purpose.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
satyaprasad veeramsetti
Greenhorn

Joined: Dec 21, 2012
Posts: 28
Please send me the answer for the question
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61227
    
  66

Please answer mine first. Without knowing the reason for the strange question, it's impossible to guess what the restrictions are.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
What is meant by "scoped variables"? Are you referring to attributes or something else?
Is that constraint you are meant to use JSTL/EL or prohibited from doing so (and if prohibited, why?)

The standard way to pass an object from a servlet to a JSP is as an attribute in scope.
From the servlet:



You then access it on the JSP page via EL: ${requestScope.myVal} or just ${myVal} which would result in 42.
similarly for ${sessionScope.mySessionVal} and ${applicationScope.myApplicationVal}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61227
    
  66

Yes, those are scoped variables. But we're still waiting for the OP to explain why they need to be avoided.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to send object from servlet to jsp without using Scoped variables