• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this a puzzle? An interview question?

Because otherwise it makes no sense to not used scoped variables for their intended purpose.
 
satyaprasad veeramsetti
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please send me the answer for the question
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please answer mine first. Without knowing the reason for the strange question, it's impossible to guess what the restrictions are.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, those are scoped variables. But we're still waiting for the OP to explain why they need to be avoided.
 
reply
    Bookmark Topic Watch Topic
  • New Topic