• 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

JSLT EL display session attribute

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a list of names in session. I want to diplay them on jsp using JSTL EL.
in servlet i place the list in session.
and in jsp i did the following

I am getting an error message like this
java.lang.IllegalStateException: jsp.error.page.noSession
Any ideas what is wrong with the code.
How to access the session attribute using JSTLEL
Thanks
 
Sheriff
Posts: 67746
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
Not sure why you are getting that particular message, but your code should be:

 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mine is working if i use scriptlet to get attribute value from session like this

and i am accessing this messages variable in forEach. it is working fine now. but i am not sure why i get that illegastateexception message when i try to use sessionScope!
Is there a way to replace the above scriptlet with EL
[ June 08, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67746
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
You should not need the scriplet. Does my version work for you? Do you get the exception on any reference to a session-scoped variable?
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i tried placing ${not empty but i am getting the error message
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That error means:

jsp.error.page.noSession=Cannot access session scope in page that does not participate
in any session

For some reason, your page has no session. You need to figure out why. What declarations do you make for the page?
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the jsp actually consists of two frames. each frame is a result of new request. is this the reason? but session should be available to jsps even if it is new request. right?
 
Bear Bibeault
Sheriff
Posts: 67746
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, are you sure that you are not using a declaration to remove one of the JSPs from the session?
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jsp is still in session. otherwise even this statement should not work.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with this because I faced similar problem because there was session=false directive declared in common page used by my page. It gave me headache over hours. Then I awared of the stack trace telling me no session in this page. When I enable it session=true and everything works well.

It might work well if you use like this. But when using sessionScope, it gonna give you session not found error.

Thanks to this link http://stackoverflow.com/questions/4730790/problem-with-session-attributes-in-jsp-el-using-spring-mvc

Cheers !

Bear Bibeault wrote:That error means:

jsp.error.page.noSession=Cannot access session scope in page that does not participate
in any session

For some reason, your page has no session. You need to figure out why. What declarations do you make for the page?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vijaya,

I am having a similar problem,

I am trying to display a sample List using EL from Servlets and Bean File, but the output is blank Browser!

Bean File -



Servlet


JSP File



 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aatish

I am having same problem , the output is blank Browser!.

how did you manage to get around this?

thanks
Muhammad



 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic